pgpool2.git / summary / log / commit / refs

commit    59b1b1eeb94ade301fd0c25a77dd295046b2ceed
Author:   Tatsuo Ishii <ishii@sraoss.co.jp>
Date:     Sun Jul 07 01:09:25 2019 +0000

    Fix query cache module so that it checks oid array's bound.


src/query_cache/pool_memqcache.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/query_cache/pool_memqcache.c b/src/query_cache/pool_memqcache.c index ed0c94dde..ef84cdc03 100644 --- a/src/query_cache/pool_memqcache.c +++ b/src/query_cache/pool_memqcache.c @@ -1195,7 +1195,7 @@ pool_extract_table_oids(Node *node, int **oidsp) foreach(cell, stmt->relations) { - if (num_oids > POOL_MAX_DML_OIDS) + if (num_oids >= POOL_MAX_DML_OIDS) { ereport(LOG, (errmsg("memcache: error while extracting table oids. too many oids:%d", num_oids))); @@ -1223,6 +1223,13 @@ pool_extract_table_oids(Node *node, int **oidsp) oid = pool_table_name_to_oid(table); if (oid > 0) { + if (num_oids >= POOL_MAX_DML_OIDS) + { + ereport(LOG, + (errmsg("memcache: error while extracting table oids. too many oids:%d", num_oids))); + return 0; + } + oids[num_oids++] = pool_table_name_to_oid(table); ereport(DEBUG1, (errmsg("memcache: extracting table oids: table: \"%s\" oid:%d", table, oid))); [parent: bff25c29ef15]