From 9472ad9279c90f8bb9e97ba7ef887ff01329530b Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sun, 7 Jul 2019 10:09:25 +0900 Subject: [PATCH] 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 4cadff9a6..0458b673f 100644 --- a/src/query_cache/pool_memqcache.c +++ b/src/query_cache/pool_memqcache.c @@ -1004,7 +1004,7 @@ int 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))); @@ -1032,6 +1032,13 @@ int 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))); -- 2.39.5