HashTable use-after-destroy in function table via stream wrapper magic __call() with nested redeclaration
未关闭
还没有人认领这个 Issue。
Bug
Category: Streams
Extension: standard
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
class Loader {
function stream_open() {
return true;
}
function __call($m, $a) {
$map[$obj] = putenv("LA=Gx$g_lang");
function __call($m, $a) {}
}
}
stream_wrapper_register('abc', 'Loader');
require 'abc://';
Resulted in this output:
/path/to/php-src/Zend/zend_hash.c(1555) : ht=0x5589df607568 is already destroyed
php: /path/to/php-src/Zend/zend_hash.c:73: _zend_is_inconsistent: Assertion `0' failed.
Aborted
Commit:
824c3891281bb4deb5a1aa245313a6c6b0ea786f
Build configuration:
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" LDFLAGS="-fsanitize=address" ./buildconf --force && ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
PHP Version
PHP 8.6.0-dev (cli) (built: Dec 6 2025 16:29:29) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
Operating System
Ubuntu 22.04
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 issue 中的 PHP 代码片段和 debug build configuration 重现该失败,然后先阅读 zend_hash.c 中报告的 assertion 附近部分。跟踪 stream wrapper 的 __call() 以及嵌套函数重新声明的路径;完成的标准是该示例不再报告 destroyed hash table,也不再 abort。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100