mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The overflow checking code already existed, but didn't work because the math was done on signed numbers instead of unsigned numbers. In the process I also discovered a pre-existing issue that needs to be fixed (and seems that other stream wrappers can have this issue too). Closes GH-18644.
30 lines
565 B
PHP
30 lines
565 B
PHP
--TEST--
|
|
GH-18642 (Signed integer overflow in ext/phar fseek)
|
|
--EXTENSIONS--
|
|
phar
|
|
--INI--
|
|
phar.require_hash=0
|
|
--FILE--
|
|
<?php
|
|
require_once __DIR__ . '/files/phar_oo_test.inc';
|
|
class MyFile extends SplFileObject
|
|
{
|
|
}
|
|
$phar = new Phar($fname);
|
|
$phar->setInfoClass('MyFile');
|
|
$f = $phar['a.php'];
|
|
var_dump($f->fseek(PHP_INT_MAX));
|
|
var_dump($f->fseek(0));
|
|
var_dump($f->fseek(PHP_INT_MIN, SEEK_END));
|
|
var_dump($f->fseek(0, SEEK_SET));
|
|
var_dump($f->fseek(1, SEEK_CUR));
|
|
var_dump($f->fseek(PHP_INT_MAX, SEEK_CUR));
|
|
?>
|
|
--EXPECT--
|
|
int(-1)
|
|
int(0)
|
|
int(-1)
|
|
int(0)
|
|
int(0)
|
|
int(-1)
|