postgresql/src
Joe Conway 96d1f423f9 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
2020-07-04 06:26:53 -04:00
..
backend Read until EOF vice stat-reported size in read_binary_file 2020-07-04 06:26:53 -04:00
bin Add --no-index-cleanup and --no-truncate to vacuumdb. 2020-06-22 13:23:38 +09:00
common Prevent compilation of frontend-only files in src/common/ with backend 2020-06-30 13:26:11 +09:00
fe_utils Mop up some no-longer-necessary hacks around printf %.*s format. 2020-06-29 17:12:38 -04:00
include Move description of libpqwalreceiver hooks out of the replication's README 2020-07-02 13:57:03 +09:00
interfaces Fix ecpg crash with bytea and cursor variables. 2020-06-30 18:34:41 +02:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Inline plpgsql's exec_stmt() into exec_stmts(). 2020-07-03 15:42:10 -04:00
port Clear some style deviations. 2020-05-21 08:31:16 -07:00
template Fix compiler warning for ppoll() on Cygwin 2019-12-22 23:20:00 +01:00
test Fix removal of files generated by TAP tests for SSL 2020-07-01 10:47:24 +09:00
timezone Remove support for timezone "posixrules" file. 2020-06-29 18:55:01 -04:00
tools Improve vacuum error context handling. 2020-07-01 07:58:36 +05:30
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Update Unicode data to Unicode 13.0.0 and CLDR 37 2020-04-24 09:52:59 +02:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00