Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure at main/streams/streams.c:1385 #16780

Open
YuanchengJiang opened this issue Nov 13, 2024 · 2 comments
Open

Assertion failure at main/streams/streams.c:1385 #16780

YuanchengJiang opened this issue Nov 13, 2024 · 2 comments

Comments

@YuanchengJiang
Copy link

Description

The following code:

<?php
$file_path = __DIR__;
$fusion = $file_path;
$h = gzopen($fusion, 'r');
var_dump(gzread($h, 10));
var_dump(gzseek( $h, 34, SEEK_CUR ) );
var_dump(gzseek( $h, -27, SEEK_CUR ) );

Resulted in this output:

/php-src/main/streams/streams.c:1385: int _php_stream_seek(php_stream *, zend_off_t, int): Assertion `stream->position >= 0' failed.
Aborted (core dumped)

PHP Version

nightly

Operating System

ubuntu 22.04

@devnexen
Copy link
Member

not very familiar with streams however it appears to me since it is not a seekable stream, its position is set to -1 but then the seek callback still proceeds and fall into this assertion. But that s just a quick look.

@devnexen
Copy link
Member

So.. either we assume it s not a seekable stream if position is -1 then we bail at this or getting the underlying php_stdio_stream_data part of the stream and checking is_seekable member.

@devnexen devnexen self-assigned this Nov 13, 2024
devnexen added a commit to devnexen/php-src that referenced this issue Nov 13, 2024
the cursor is set to -1 when deemed non seekable, thus we bail out early
in the process.
devnexen added a commit to devnexen/php-src that referenced this issue Nov 13, 2024
the stream flags is set to non seekable, thus we bail out early
in the process.
devnexen added a commit to devnexen/php-src that referenced this issue Nov 13, 2024
the stream flags is set to non seekable, thus we bail out early
in the process.
devnexen added a commit to devnexen/php-src that referenced this issue Nov 13, 2024
the stream flags is set to non seekable, thus we bail out early
in the process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants