| From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Petr Jelinek <petr(at)2ndquadrant(dot)com> |
| Subject: | Dereferenced pointer in tablesample.c |
| Date: | 2015-06-30 07:10:49 |
| Message-ID: | CAB7nPqSq06h2tVH7RoVnXmj_da4uGzxnk2-JUZnphG1NFqfYuQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
(Petr in CC)
Coverity is complaining about the following pointer dereference in
tablesample_init(at)tablesample(dot)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
| Attachment | Content-Type | Size |
|---|---|---|
| 20150630_tablesample_dereference.patch | text/x-patch | 707 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2015-06-30 07:13:25 | Re: Reducing ClogControlLock contention |
| Previous Message | Simon Riggs | 2015-06-30 07:02:25 | Reducing ClogControlLock contention |