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
UBSan: negation of LONG_MIN in ext/pdo_sqlite/pdo_sqlite.c leads to undefined behavior #20927
<?php$db = newPdo\Sqlite('sqlite::memory:');
$db->exec('CREATE TABLE test (id STRING, data BLOB)');
$insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
$insert_stmt->bindValue(1, 'a', PDO::PARAM_STR);
$insert_stmt->bindValue(2, 'TEST TEST', PDO::PARAM_LOB);
$insert_stmt->execute();
$stream = $db->openBlob('test', 'data', 1);
fseek($stream, PHP_INT_MIN, SEEK_END);
var_dump(stream_get_contents($stream));
Resulted in this output:
sapi/cli/php z.php 1 ✘
/home/arshid/Desktop/php-src/ext/pdo_sqlite/pdo_sqlite.c:246:47: runtime error: negation of -9223372036854775808 cannot be represented in type 'zend_off_t' (aka 'long'); cast to an unsigned type to negate this value to itself
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/arshid/Desktop/php-src/ext/pdo_sqlite/pdo_sqlite.c:246:47 in
Activity
Fix phpGH-20964: fseek() on php://memory with PHP_INT_MIN causes unde…
Fix phpGH-20964: fseek() on php://memory with PHP_INT_MIN causes unde…