Skip to content

Commit 5107483

Browse files
authored
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.
1 parent 82b0537 commit 5107483

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Zend/zend_ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,8 @@ static void* ZEND_FASTCALL zend_ast_tree_copy(zend_ast *ast, void *buf)
10631063
new->kind = ZEND_AST_ZVAL;
10641064
new->attr = ast->attr;
10651065
ZVAL_COPY(&new->val, zend_ast_get_zval(ast));
1066+
Z_LINENO(new->val) = zend_ast_get_lineno(ast);
10661067
buf = (void*)((char*)buf + sizeof(zend_ast_zval));
1067-
// Lineno gets copied with ZVAL_COPY
10681068
} else if (ast->kind == ZEND_AST_CONSTANT) {
10691069
zend_ast_zval *new = (zend_ast_zval*)buf;
10701070
new->kind = ZEND_AST_CONSTANT;

0 commit comments

Comments
 (0)