Dereferenced pointer in tablesample.c

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Dereferenced pointer in tablesample.c
Дата
Msg-id CAB7nPqSq06h2tVH7RoVnXmj_da4uGzxnk2-JUZnphG1NFqfYuQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Dereferenced pointer in tablesample.c
Список pgsql-hackers
Hi all,
(Petr in CC)

Coverity is complaining about the following pointer dereference in tablesample_init@tablesample.c:
+               ExprState  *argstate = ExecInitExpr(argexpr, (PlanState *) scanstate);
+
+               if (argstate == NULL)
+               {
+                       fcinfo.argnull[i] = true;
+                       fcinfo.arg[i] = (Datum) 0;;
+               }
+
+               fcinfo.arg[i] = ExecEvalExpr(argstate, econtext,
+                                                                        &fcinfo.argnull[i], NULL);

If the expression argstate is NULL when calling ExecInitExpr(), argstate is going to be NULL and dereferenced afterwards, see execQual.c for more details. Hence I think that the patch attached should be applied. Thoughts?

At the same time I noted a double semicolon, fixed as well in the attached.
Regards,
--
Michael
Вложения

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Reducing ClogControlLock contention
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Reducing ClogControlLock contention