| From: | Ranier Vilela <ranier_gyn(at)hotmail(dot)com> |
|---|---|
| To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | RE: [PATCH] Fix possible underflow in expression (maxoff - 1) |
| Date: | 2019-11-24 19:21:06 |
| Message-ID: | MN2PR18MB29279B0857068B7DC06D1269E34B0@MN2PR18MB2927.namprd18.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mark Dilger | 2019-11-24 19:24:35 | Re: LISTEN/NOTIFY testing woes |
| Previous Message | Julien Rouhaud | 2019-11-24 19:17:01 | Re: Collation versioning |