Unlikely-to-happen crash in ecpg driver caused by NULL-pointer check not done - Mailing list pgsql-hackers

From Michael Paquier
Subject Unlikely-to-happen crash in ecpg driver caused by NULL-pointer check not done
Date
Msg-id CAB7nPqSnZMiRMZ_HJ2XLm2i9jcs3SPRJ-8hBmG0f24OjHcyc+A@mail.gmail.com
Whole thread Raw
Responses Re: Unlikely-to-happen crash in ecpg driver caused by NULL-pointer check not done  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Hi all,

In ecpg_add_mem of memory.c, we use ecpg_alloc but there is actually
no NULL-pointer check. If an OOM shows up exactly at this point, this
is likely to cause a crash. Attached patch adds some extra processing
to ecpg_add_mem to check if the allocation fails, and to fail properly
if an OOM appears.
This issue has been pointed out by Coverity, and I guessed the legwork
needed by myself.
Regards,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Missing markup in pg_receivexlog.sgml
Next
From: "Stephen R. van den Berg"
Date:
Subject: Table description in the data file (Re: pg_rawdump)