From 70dfbe00684eb1c31d5b49f643e4736696c3b7df Mon Sep 17 00:00:00 2001 From: Adam Seitz Date: Wed, 2 Dec 2020 00:40:16 +0100 Subject: Fix #80384: limit read buffer size In the case of a stream with no filters, php_stream_fill_read_buffer only reads stream->chunk_size into the read buffer. If the stream has filters attached, it could unnecessarily buffer a large amount of data. With this change, php_stream_fill_read_buffer only proceeds until either the requested size or stream->chunk_size is available in the read buffer. Co-authored-by: Christoph M. Becker Closes GH-6444. --- tests/basic/bug80384.phpt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/basic/bug80384.phpt (limited to 'tests/basic') diff --git a/tests/basic/bug80384.phpt b/tests/basic/bug80384.phpt new file mode 100644 index 0000000000..cf30e8601b --- /dev/null +++ b/tests/basic/bug80384.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #80384 large reads cause filters to internally buffer large amounts of memory +--FILE-- + +--CLEAN-- + +--EXPECT-- +bool(true) -- cgit v1.2.1