pgsql: Fix overflow in Windows replacement pg_pread/pg_pwrite.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix overflow in Windows replacement pg_pread/pg_pwrite.
Date: 2024-03-02 19:47:12
Message-ID: E1rgVKB-001jv6-M2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix overflow in Windows replacement pg_pread/pg_pwrite.

When calling the Windows file I/O APIs there is an implicit conversion
from size_t to DWORD, which could overflow. Clamp the size at 1GB to
avoid that.

Not a really a live bug as we don't expect anything in PostgreSQL to
call with such large values.

Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Discussion: https://postgr.es/m/1672202.1703441340%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1e013746544bd1f9df70f5547894fd72719c4b85

Modified Files
--------------
src/port/win32pread.c | 3 +++
src/port/win32pwrite.c | 3 +++
2 files changed, 6 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2024-03-02 21:40:45 pgsql: Documentation update for Standard Collations.
Previous Message Thomas Munro 2024-03-01 23:15:26 pgsql: Return ssize_t in fd.c I/O functions.