1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Correctly copy lineno for zval asts (#11203)

The comment was incorrect. Zval ASTs store their lineno in u2, but u2 does not
get copied in ZVAL_COPY. This triggers use-of-uninitialized errors with MSAN.
Unfortunately, I don't have a simple reproducer.
This commit is contained in:
Ilija Tovilo
2023-05-07 13:17:19 +02:00
committed by GitHub
parent 82b05373b1
commit 5107483cd6

View File

@@ -1063,8 +1063,8 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
new->kind = ZEND_AST_ZVAL;
new->attr = ast->attr;
ZVAL_COPY(&new->val, zend_ast_get_zval(ast));
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
// Lineno gets copied with ZVAL_COPY
} else if (ast->kind == ZEND_AST_CONSTANT) {
zend_ast_zval *new = (zend_ast_zval*)buf;
new->kind = ZEND_AST_CONSTANT;