Re: BUG #16188: The usage of NULL pointer in rege_dfa.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: starbugs(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16188: The usage of NULL pointer in rege_dfa.c
Date: 2020-01-06 04:09:01
Message-ID: 739.1578283741@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-01-06 04:11:27 Re: BUG #16189: The usage of NULL pointer in indexpath.c
Previous Message PG Bug reporting form 2020-01-06 04:00:17 BUG #16191: Errors of division by zero occur in several files.