pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Read until EOF vice stat-reported size in read_binary_file 4+ messages / 1 participants [nested] [flat]
* pgsql: Read until EOF vice stat-reported size in read_binary_file @ 2020-07-04 10:30 Joe Conway <mail@joeconway.com> 0 siblings, 0 replies; 4+ messages in thread From: Joe Conway @ 2020-07-04 10:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Read until EOF vice stat-reported size in read_binary_file read_binary_file(), used by SQL functions pg_read_file() and friends, uses stat to determine file length to read, when not passed an explicit length as an argument. This is problematic, for example, if the file being read is a virtual file with a stat-reported length of zero. Arrange to read until EOF, or StringInfo data string lenth limit, is reached instead. Original complaint and patch by me, with significant review, corrections, advice, and code optimizations by Tom Lane. Backpatched to v11. Prior to that only paths relative to the data and log dirs were allowed for files, so no "zero length" files were reachable anyway. Reviewed-By: Tom Lane Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com Backpatch-through: 11 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/96d1f423f95d15c74989336e0776e1d55561a3f1 Modified Files -------------- contrib/adminpack/expected/adminpack.out | 4 +- src/backend/utils/adt/genfile.c | 91 ++++++++++++++++++++++---------- 2 files changed, 66 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Read until EOF vice stat-reported size in read_binary_file @ 2020-07-04 10:30 Joe Conway <mail@joeconway.com> 0 siblings, 0 replies; 4+ messages in thread From: Joe Conway @ 2020-07-04 10:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Read until EOF vice stat-reported size in read_binary_file read_binary_file(), used by SQL functions pg_read_file() and friends, uses stat to determine file length to read, when not passed an explicit length as an argument. This is problematic, for example, if the file being read is a virtual file with a stat-reported length of zero. Arrange to read until EOF, or StringInfo data string lenth limit, is reached instead. Original complaint and patch by me, with significant review, corrections, advice, and code optimizations by Tom Lane. Backpatched to v11. Prior to that only paths relative to the data and log dirs were allowed for files, so no "zero length" files were reachable anyway. Reviewed-By: Tom Lane Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com Backpatch-through: 11 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0025c3a2c295459002711e0b37e48e3b067a83ba Modified Files -------------- contrib/adminpack/expected/adminpack.out | 4 +- src/backend/utils/adt/genfile.c | 91 ++++++++++++++++++++++---------- 2 files changed, 66 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Read until EOF vice stat-reported size in read_binary_file @ 2020-07-04 10:30 Joe Conway <mail@joeconway.com> 0 siblings, 0 replies; 4+ messages in thread From: Joe Conway @ 2020-07-04 10:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Read until EOF vice stat-reported size in read_binary_file read_binary_file(), used by SQL functions pg_read_file() and friends, uses stat to determine file length to read, when not passed an explicit length as an argument. This is problematic, for example, if the file being read is a virtual file with a stat-reported length of zero. Arrange to read until EOF, or StringInfo data string lenth limit, is reached instead. Original complaint and patch by me, with significant review, corrections, advice, and code optimizations by Tom Lane. Backpatched to v11. Prior to that only paths relative to the data and log dirs were allowed for files, so no "zero length" files were reachable anyway. Reviewed-By: Tom Lane Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com Backpatch-through: 11 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/015e899a7a671a42f11468afb12e1415415a1da8 Modified Files -------------- contrib/adminpack/expected/adminpack.out | 4 +- src/backend/utils/adt/genfile.c | 91 ++++++++++++++++++++++---------- 2 files changed, 66 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Read until EOF vice stat-reported size in read_binary_file @ 2020-07-04 10:30 Joe Conway <mail@joeconway.com> 0 siblings, 0 replies; 4+ messages in thread From: Joe Conway @ 2020-07-04 10:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Read until EOF vice stat-reported size in read_binary_file read_binary_file(), used by SQL functions pg_read_file() and friends, uses stat to determine file length to read, when not passed an explicit length as an argument. This is problematic, for example, if the file being read is a virtual file with a stat-reported length of zero. Arrange to read until EOF, or StringInfo data string lenth limit, is reached instead. Original complaint and patch by me, with significant review, corrections, advice, and code optimizations by Tom Lane. Backpatched to v11. Prior to that only paths relative to the data and log dirs were allowed for files, so no "zero length" files were reachable anyway. Reviewed-By: Tom Lane Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com Backpatch-through: 11 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c2cdaf0cb912fa24ac56170c7c47a2fc398e2516 Modified Files -------------- contrib/adminpack/expected/adminpack.out | 4 +- src/backend/utils/adt/genfile.c | 91 ++++++++++++++++++++++---------- 2 files changed, 66 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-07-04 10:30 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-07-04 10:30 pgsql: Read until EOF vice stat-reported size in read_binary_file Joe Conway <mail@joeconway.com> 2020-07-04 10:30 pgsql: Read until EOF vice stat-reported size in read_binary_file Joe Conway <mail@joeconway.com> 2020-07-04 10:30 pgsql: Read until EOF vice stat-reported size in read_binary_file Joe Conway <mail@joeconway.com> 2020-07-04 10:30 pgsql: Read until EOF vice stat-reported size in read_binary_file Joe Conway <mail@joeconway.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox