Re: Possible integer overflow in bringetbitmap()
James Hunter <james.hunter.pg@gmail.com>
From: James Hunter <james.hunter.pg@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Evgeniy Gorbanyov <gorbanyoves@basealt.ru>,
pgsql-hackers@lists.postgresql.org
Date: 2024-12-05T16:46:45Z
Lists: pgsql-hackers
On Wed, Dec 4, 2024 at 10:13 PM Michael Paquier <michael@paquier.xyz> wrote: > > totalpages is signed, and BlockNumber is unsigned. Hence in theory > you could always fall into a trap once totalpages gets higher than > (2^31 - 1), no? This is not going to be a problem in practice even if > the number of pages per range assigned to brin can be 1, still.. Good point -- so the fix should be something like: (a) make totalpages a BlockNumber or uint32; (b) cast either "totalpages" or "10" to int64, before returning the result? James
Commits
-
Fix potential integer overflow in bringetbitmap()
- 332023e2d032 13.19 landed
- e35ff6520569 14.16 landed
- 9e9f30139eb8 15.11 landed
- bfda7d8dd6b3 16.7 landed
- e027ee9902fa 17.3 landed
- 720e529840d5 18.0 landed