Skip to content

Commit 039cab2

Browse files
committed
Fix GH-16780: gzseek aborts on non seekable stream.
the stream flags is set to non seekable, thus we bail out early in the process.
1 parent 45487c6 commit 039cab2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main/streams/streams.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,11 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence)
13211321
}
13221322
}
13231323

1324+
/* the stream is not properly seekable */
1325+
if (stream->flags & PHP_STREAM_FLAG_NO_SEEK) {
1326+
goto fail;
1327+
}
1328+
13241329
/* handle the case where we are in the buffer */
13251330
if ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) == 0) {
13261331
switch(whence) {
@@ -1393,6 +1398,7 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence)
13931398
return 0;
13941399
}
13951400

1401+
fail:
13961402
php_error_docref(NULL, E_WARNING, "Stream does not support seeking");
13971403

13981404
return -1;

0 commit comments

Comments
 (0)