From: Christoph M. Becker Date: Fri, 17 Apr 2020 13:48:20 +0000 (+0200) Subject: Fix #71263: fread() does not report bzip2.decompress errors X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d757be640f5105b8542b781ce93804af494229a8;p=php 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. --- diff --git a/NEWS b/NEWS index 430edada41..5e6ff58f39 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ PHP NEWS . Fixed bug #79368 ("Unexpected end of file" is not an acceptable error message). (Alex Dowad) +- BZ2: + . Fixed bug #71263 (fread() does not report bzip2.decompress errors). (cmb) + - CURL: . Bumped required libcurl version to 7.29.0. (cmb) diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index 40e01edca0..bb001198f4 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 108469a293..b20bbd8ef1 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)