Assertion `zval_get_type(&(*(zptr))) == 6 && "Concat should return string"' failed
オープン
まだ誰も着手していません。
Bug
Status: Needs Triage
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
class A
{
public string $prop = "";
}
class B
{
public function __toString()
{
global $a;
$a = $a = "";
$a->p = "";
return "";
}
}
$a = new A();
$a = $a->prop .= new B();
?>
Resulted in this output:
php-src/Zend/zend_execute.c:1582: zend_binary_assign_op_typed_prop: Assertion `zval_get_type(&(*(zptr))) == 6 && "Concat should return string"' failed.
With asan, the output is:
==5503==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x555555ef095f bp 0x7fffffff9b00 sp 0x7fffffff9ad0 T0)
==5503==The signal is caused by a WRITE memory access.
==5503==Hint: address points to the zero page.
#0 0x555555ef095e in zend_gc_addref /php-src/Zend/zend_types.h:1210
#1 0x555555ef095e in ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HANDLER /php-src/Zend/zend_vm_execute.h:40931
#2 0x555555f5c7cf in execute_ex /php-src/Zend/zend_vm_execute.h:60234
#3 0x555555f91637 in zend_execute /php-src/Zend/zend_vm_execute.h:61087
...)
It seems a use-after-free bug.
PHP Version
PHP 8.3.0-dev
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された PHP スニペットを ASAN ビルドで再現し、次に Zend/zend_execute.c の zend_binary_assign_op_typed_prop と、Zend/zend_vm_execute.h および Zend/zend_types.h の関連する実行パスを調査します。再現によって assertion や不正な書き込みが発生しなくなり、その動作が回帰テストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100