From 7ed262837925c3510df35e72e3b1fa5b83def539 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 17 Apr 2020 15:48:20 +0200 Subject: [PATCH] Fix #71263: fread() does not report bzip2.decompress errors If the bzip2.decompress filter fails to decompress the stream, we raise a notice instead of failing silently. --- ext/bz2/bz2_filter.c | 1 + ext/bz2/tests/bug71263.phpt | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index 40e01edca0201..bb001198f4266 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -123,6 +123,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter( } } else if (status != BZ_OK) { /* Something bad happened */ + php_error_docref(NULL, E_NOTICE, "bzip2 decompression failed"); php_stream_bucket_delref(bucket); return PSFS_ERR_FATAL; } diff --git a/ext/bz2/tests/bug71263.phpt b/ext/bz2/tests/bug71263.phpt index 108469a2930e6..b20bbd8ef1daa 100644 --- a/ext/bz2/tests/bug71263.phpt +++ b/ext/bz2/tests/bug71263.phpt @@ -1,12 +1,10 @@ --TEST-- -Bug #71263: fread() does not detects decoding errors from filter bzip2.decompress +Bug #71263: fread() does not report bzip2.decompress errors --SKIPIF-- --FILE-- ---EXPECT-- +--EXPECTF-- Compressed len = 81 + +Notice: fread(): bzip2 decompression failed in %s on line %d read: bool(false) Compressed len = 81 read: string(0) "" Compressed len = 81 + +Notice: fread(): bzip2 decompression failed in %s on line %d read: bool(false)