pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16188: The usage of NULL pointer in rege_dfa.c
2+ messages / 2 participants
[nested] [flat]

* BUG #16188: The usage of NULL pointer in rege_dfa.c
@ 2020-01-06 03:20 PG Bug reporting form <noreply@postgresql.org>
  2020-01-06 04:09 ` Re: BUG #16188: The usage of NULL pointer in rege_dfa.c Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2020-01-06 03:20 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: starbugs@qq.com

The following bug has been logged on the website:

Bug reference:      16188
Logged by:          Jian Zhang
Email address:      starbugs@qq.com
PostgreSQL version: 12.1
Operating system:   Linux
Description:        

We checked the code in file “rege_dfa.c” and there is one error occurring in
line 481. This error is caused by the usage of pointer with NULL value. The
code in this line is “d->work = &d->statesarea[nss * wordsper];” We checked
the code two lines before the error occurred line and the code is
“d->statesarea = (unsigned *) MALLOC((nss + WORK) * wordsper
*sizeof(unsigned));”. We found the code hasn’t checked weather the process
“MALLOC” is success or not which directly define the value of the
“statesarea” field of pointer “d”. This “statesarea” field of pointer “d” is
used later in line 481. The program should check the effectiveness of the
return value of function “MALLOC” to avoid this error.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16188: The usage of NULL pointer in rege_dfa.c
  2020-01-06 03:20 BUG #16188: The usage of NULL pointer in rege_dfa.c PG Bug reporting form <noreply@postgresql.org>
@ 2020-01-06 04:09 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-01-06 04:09 UTC (permalink / raw)
  To: starbugs@qq.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> We checked the code in file “rege_dfa.c” and there is one error occurring in
> line 481. This error is caused by the usage of pointer with NULL value. The
> code in this line is “d->work = &d->statesarea[nss * wordsper];” We checked
> the code two lines before the error occurred line and the code is
> “d->statesarea = (unsigned *) MALLOC((nss + WORK) * wordsper
> *sizeof(unsigned));”. We found the code hasn’t checked weather the process
> “MALLOC” is success or not which directly define the value of the
> “statesarea” field of pointer “d”.

I don't see any bug there.  If the malloc for statesarea fails, the
code will exit a few lines further down, without ever having dereferenced
d->work.  So whether d->work is a valid pointer or not is irrelevant.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-01-06 04:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 03:20 BUG #16188: The usage of NULL pointer in rege_dfa.c PG Bug reporting form <noreply@postgresql.org>
2020-01-06 04:09 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox