BUG #18849: DEREF_OF_NULL.RET Pointer '&partexprs_item.ptr_value', returned from function 'list_head' at partiti

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #18849: DEREF_OF_NULL.RET Pointer '&partexprs_item.ptr_value', returned from function 'list_head' at partiti
Дата
Msg-id 18849-4a0299b366741739@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18849
Logged by:          Nikita
Email address:      pm91.arapov@gmail.com
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:

In principle, if data structure is correct there will be no problems. As for
correct structure it is known that there will be a non-NULL value. However
in other places that deal with the same structure the appropriate checks are
present. So for consistency we can add such a check here as well. On other
hand if the structure is checked for correctness in other places there is no
need to check it once again. So the decision on this is not very certain.

diff --git a/src/backend/catalog/partition.c
b/src/backend/catalog/partition.c
--- a/src/backend/catalog/partition.c    (revision
a49ac80219c6f28c3cf3973f797de637329952da)
+++ b/src/backend/catalog/partition.c    (date 1740397337018)
@@ -283,6 +283,8 @@
         }
         else
         {
+            if(partexprs_item == NULL)
+                return false;
             /* Arbitrary expression */
             Node       *expr = (Node *) lfirst(partexprs_item);
             Bitmapset  *expr_attrs = NULL;

I suggest the following patch fixing this issue


В списке pgsql-bugs по дате отправления: