Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioJhX-0003rX-1F for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 04:09:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioJhU-0002OJ-OE for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 04:09:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioJhU-0002OC-Fz for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 04:09:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ioJhR-0007E1-RL for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 04:09:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 006491he000740; Sun, 5 Jan 2020 23:09:01 -0500 From: Tom Lane To: starbugs@qq.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16188: The usage of NULL pointer in rege_dfa.c In-reply-to: <16188-c632b0d6f863a87e@postgresql.org> References: <16188-c632b0d6f863a87e@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 06 Jan 2020 03:20:01 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <738.1578283741.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 05 Jan 2020 23:09:01 -0500 Message-ID: <739.1578283741@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > We checked the code in file =E2=80=9Crege_dfa.c=E2=80=9D and there is on= e error occurring in > line 481. This error is caused by the usage of pointer with NULL value. = The > code in this line is =E2=80=9Cd->work =3D &d->statesarea[nss * wordsper]= ;=E2=80=9D We checked > the code two lines before the error occurred line and the code is > =E2=80=9Cd->statesarea =3D (unsigned *) MALLOC((nss + WORK) * wordsper > *sizeof(unsigned));=E2=80=9D. We found the code hasn=E2=80=99t checked w= eather the process > =E2=80=9CMALLOC=E2=80=9D is success or not which directly define the val= ue of the > =E2=80=9Cstatesarea=E2=80=9D field of pointer =E2=80=9Cd=E2=80=9D. 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