Re: ARRNELEMS Out-of-bounds possible errors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nikita Malakhov <hukutoc(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, ranier(dot)vf(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ARRNELEMS Out-of-bounds possible errors
Date: 2022-12-24 16:05:27
Message-ID: 2919523.1671897927@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nikita Malakhov <hukutoc(at)gmail(dot)com> writes:
> Even with null context it does not turn to ereport, and returns dummy value

Read the code. ArrayGetNItems passes NULL for escontext, therefore
if there's a problem the ereturn calls in ArrayGetNItemsSafe will
throw error, *not* return -1.

Not sure how we could persuade Coverity of that, though,
if it fails to understand that for itself.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-12-24 20:23:38 Re: Error-safe user functions
Previous Message Tom Lane 2022-12-24 15:48:11 Re: Error-safe user functions