RE: [PATCH] Fix possible underflow in expression (maxoff - 1) - Mailing list pgsql-hackers

From Ranier Vilela
Subject RE: [PATCH] Fix possible underflow in expression (maxoff - 1)
Date
Msg-id MN2PR18MB29279B0857068B7DC06D1269E34B0@MN2PR18MB2927.namprd18.prod.outlook.com
Whole thread Raw
In response to Re: [PATCH] Fix possible underflow in expression (maxoff - 1)  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: [PATCH] Fix possible underflow in expression (maxoff - 1)  (Peter Geoghegan <pg@bowt.ie>)
Re: [PATCH] Fix possible underflow in expression (maxoff - 1)  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
>In general, it's not possible to split a page without it being
>initialized, and having at least 2 items (not including the incoming
>newitem). Besides, even if "maxoff" had an integer underflow the
>behavior of the function would still be sane and defined. OffsetNumber
>is an unsigned type.
Well, I didn't mean that it's failing..I meant it could fail..
If PageGetMaxOffsetNumber, can return zero, maxoff can be zero.
(0 - 1), on unsigned type, certainly is underflow and if maxoff can be one,
(1 - 1) is zero, and state->newitemsz * (maxoff - 1), is zero.

>Where are you getting this stuff from? Are you using a static analysis tool?
Yes,two static tools,  but reviewed by me.

Best regards.
Ranier Vilela

--
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Collation versioning
Next
From: Mark Dilger
Date:
Subject: Re: LISTEN/NOTIFY testing woes