pdo_sqlite segmentation fault
还没有人认领这个 Issue。
评估
调研方向
从 issue 中的复现程序开始,检查 ext/pdo_sqlite/sqlite_statement.c:54,然后在 collation callback 关闭游标时,跟踪经过 ext/pdo/pdo_stmt.c:456 的调用。完成的标准是:提供的脚本在 AddressSanitizer 下不再发生 segfault,并且该行为由适当的回归测试覆盖。
由索引模型根据 Issue 内容生成。
描述
Description
The following code:
<?php
$db = Pdo\Sqlite::connect('sqlite::memory:');
$db->exec("CREATE TABLE t(x TEXT)");
$db->exec("INSERT INTO t VALUES ('b'),('a'),('c'),('d'),('e')");
$stmt = null;
$db->createCollation('evil', function ($a, $b) use (&$stmt) {
$stmt->closeCursor();
return $a <=> $b;
});
$stmt = $db->prepare("SELECT x FROM t ORDER BY x COLLATE evil");
$stmt->execute();
Resulted in this output:
Deprecated: Method PDO::sqliteCreateCollation() is deprecated since 8.5, use Pdo\Sqlite::createCollation() instead in /audit/repro/battery7/e7_06_collation_closecursor.php on line 8
AddressSanitizer:DEADLYSIGNAL
=================================================================
==7==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0xffffe64c9040 sp 0xffffe64c9020 T0)
==7==Hint: pc points to the zero page.
==7==The signal is caused by a READ memory access.
==7==Hint: address points to the zero page.
#0 0x0 (<unknown module>)
LLVMSymbolizer: error reading file: No such file or directory
#1 0xffffade2578c (linux-vdso.so.1+0x78c)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (<unknown module>)
==7==ABORTING
gdb backtrace:
#0 0x0000000000000000 in ?? ()
#1 0x... in ?? () from /lib/.../libsqlite3.so.0
#2 0x... in ?? () from /lib/.../libsqlite3.so.0
#3 sqlite3VdbeExec () from libsqlite3.so.0
#4 sqlite3_step () from libsqlite3.so.0
#5 pdo_sqlite_stmt_execute (stmt=...) at ext/pdo_sqlite/sqlite_statement.c:54
#6 zim_PDOStatement_execute (...) at ext/pdo/pdo_stmt.c:456
...
PHP Version
8.6.0-dev
Operating System
Ubuntu 22.04
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 103
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug SAPI: cli_server Status: Verified
难度 2/5 1-3 小时 新手友好度 88/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
-
Bug Status: Needs Triage
难度 1/5 1 小时以内 新手友好度 90/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
-
Bug Category: Tests Status: Verified
难度 2/5 1-3 小时 新手友好度 68/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
HarbourMasters/Shipwright#7229 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 条评论 ·