From d6b8f17d493f73e29d89242b05a89827a790543e Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 20 Oct 2020 18:46:35 +0200 Subject: [PATCH] Disallow seeking on filtered streams Most filters cannot deal with that, so we should disallow it. --- main/streams/streams.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/streams/streams.c b/main/streams/streams.c index 1262c874f7e88..c24cb45796f55 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1294,6 +1294,10 @@ PHPAPI zend_off_t _php_stream_tell(php_stream *stream) PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence) { + if (php_stream_is_filtered(stream)) { + return -1; + } + if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { /* flush to commit data written to the fopencookie FILE* */ fflush(stream->stdiocast);