Re: ARRNELEMS Out-of-bounds possible errors - Mailing list pgsql-hackers

From Nikita Malakhov
Subject Re: ARRNELEMS Out-of-bounds possible errors
Date
Msg-id CAN-LCVO5kS1tmvTwM8hMaVTMrWhjV00rWLfukMpECk9poZ_HKA@mail.gmail.com
Whole thread Raw
In response to Re: ARRNELEMS Out-of-bounds possible errors  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ARRNELEMS Out-of-bounds possible errors  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
Hi,

My bad, I was misleaded by unconditional return in ereturn_domain.
Sorry for the noise.


On Sat, Dec 24, 2022 at 7:05 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Nikita Malakhov <hukutoc@gmail.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


--
Regards,
Nikita Malakhov
Postgres Professional 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error-safe user functions
Next
From: Ranier Vilela
Date:
Subject: Re: ARRNELEMS Out-of-bounds possible errors