You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Signed integer overflow in main/streams/streams.c #15980
<?php$file_modes = array( "w","wb","wt","w+","w+b","w+t",
"x","xb","xt","x+","x+b","x+t");
$file_content_types = array( "text_with_new_line","alphanumeric");
$offset = array(-1,0,1,PHP_INT_MAX,600); // different offsets$filename = __DIR__."/fseek_ftell_rewind_variation6.tmp"; // this is name of the file created by create_files()foreach($file_content_typesas$file_content_type){
foreach($file_modesas$file_mode) {
$file_handle = fopen($filename, $file_mode);
foreach($offsetas$count){
var_dump( fseek($file_handle,$count,SEEK_CUR) );
} //end of offset loop
} //end of file_mode loop
} //end of file_content_types loop
Resulted in this output:
/php-src/main/streams/streams.c:1385:31: runtime error: signed integer overflow: 1 + 9223372036854775807 cannot be represented in type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/main/streams/streams.c:1385:31 in
Activity
cmb69 commentedon Sep 22, 2024
Simple reproducer:
Possible fix:
Older PHP versions are likely affected as well.
Fix phpGH-15980: Signed integer overflow in main/streams/streams.c
Fix GH-15980: Signed integer overflow in main/streams/streams.c
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'
Revert "Fix GH-15980: Signed integer overflow in main/streams/streams.c"
Merge branch 'PHP-8.2' into PHP-8.3
1 remaining item
cmb69 commentedon Sep 22, 2024
I had to revert, so reopening.
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'
Fix GH-15980: Signed integer overflow in main/streams/streams.c