aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2025-04-07 08:47:30 -0400
committerAndres Freund <andres@anarazel.de>2025-04-07 09:45:00 -0400
commit8ce79483dc47df11159f506cf51bacec9f874055 (patch)
tree9cc7b5deef30bcaf1fb57a35672ca96387bd4fe8 /doc/src
parent717d0e8dd945edea7c7e875bdb2553238a94f885 (diff)
downloadpostgresql-8ce79483dc47df11159f506cf51bacec9f874055.tar.gz
postgresql-8ce79483dc47df11159f506cf51bacec9f874055.zip
read_stream: Fix overflow hazard with large shared buffers
If the limit returned by GetAdditionalPinLimit() is large, the buffer_limit variable in read_stream_start_pending_read() can overflow. While the code is careful to limit buffer_limit PG_INT16_MAX, we subsequently add the number of forwarded buffers. The overflow can lead to assertion failures, crashes or wrong query results when using large shared buffers. It seems easier to avoid this if we make the buffer_limit variable an int, instead of an int16. Do so, and clamp buffer_limit after adding the number of forwarded buffers. It's possible we might want to address this and related issues more widely by changing to int instead of int16 more widely, but since the consequences of this bug can be confusing, it seems better to fix it now. This bug was introduced in ed0b87caaca. Discussion: https://postgr.es/m/ewvz3cbtlhrwqk7h6ca6cctiqh7r64ol3pzb3iyjycn2r5nxk5@tnhw3a5zatlr
Diffstat (limited to 'doc/src')
0 files changed, 0 insertions, 0 deletions