[php-src] Issue #9138: NULL pointer dereference when fetching property of "bad" list

From: Date: Mon, 25 Jul 2022 18:44:07 +0000
Subject: [php-src] Issue #9138: NULL pointer dereference when fetching property of "bad" list
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242017@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9138 Author: dstogov ### Description The following code: ```php <?php #[Attribute([,]->e)] class Foo {} ``` Resulted in this output: ``` /home/dmitry/php/php-master/Zend/zend_ast.c:697:14: runtime error: member access within null pointer of type 'struct zend_ast' AddressSanitizer:DEADLYSIGNAL ================================================================= ==937983==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000241295f bp 0x7ffc25370350 sp 0x7ffc2536ff20 T0) ==937983==The signal is caused by a READ memory access. ==937983==Hint: address points to the zero page. #0 0x241295f in zend_ast_evaluate_ex /home/dmitry/php/php-master/Zend/zend_ast.c:697 #1 0x2415421 in zend_ast_evaluate_ex /home/dmitry/php/php-master/Zend/zend_ast.c:921 #2 0x2415fff in zend_ast_evaluate /home/dmitry/php/php-master/Zend/zend_ast.c:989 #3 0x1f4248b in zval_update_constant_ex /home/dmitry/php/php-master/Zend/zend_execute_API.c:692 #4 0x2070add in zend_get_attribute_value /home/dmitry/php/php-master/Zend/zend_attributes.c:210 #5 0x206e6c4 in validate_attribute /home/dmitry/php/php-master/Zend/zend_attributes.c:46 #6 0x1ef81db in zend_compile_attributes /home/dmitry/php/php-master/Zend/zend_compile.c:6628 #7 0x1f087b1 in zend_compile_class_decl /home/dmitry/php/php-master/Zend/zend_compile.c:7813 #8 0x1f268ab in zend_compile_top_stmt /home/dmitry/php/php-master/Zend/zend_compile.c:9992 #9 0x1f26590 in zend_compile_top_stmt /home/dmitry/php/php-master/Zend/zend_compile.c:9981 #10 0x1e31caa in zend_compile Zend/zend_language_scanner.l:619 #11 0x1e323b2 in compile_file Zend/zend_language_scanner.l:654 #12 0x14fdfcb in phar_compile_file /home/dmitry/php/php-master/ext/phar/phar.c:3346 #13 0x7feb1a9f2d71 in opcache_compile_file /home/dmitry/php/php-master/ext/opcache/ZendAccelerator.c:1812 #14 0x7feb1a9f8349 in persistent_compile_file /home/dmitry/php/php-master/ext/opcache/ZendAccelerator.c:2156 #15 0x1fb4b57 in zend_execute_scripts /home/dmitry/php/php-master/Zend/zend.c:1765 #16 0x1d50d79 in php_execute_script /home/dmitry/php/php-master/main/main.c:2535 #17 0x2700a89 in do_cli /home/dmitry/php/php-master/sapi/cli/php_cli.c:964 #18 0x270311c in main /home/dmitry/php/php-master/sapi/cli/php_cli.c:1333 #19 0x7feb2cc4043f in __libc_start_call_main (/lib64/libc.so.6+0x4043f) #20 0x7feb2cc404ef in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x404ef) #21 0x608684 in _start (/home/dmitry/php/php-master/CGI-DEBUG-64/sapi/cli/php+0x608684) ``` But I expected this output instead: ``` Fatal error: Constant expression contains invalid operations ``` ### PHP Version master ### Operating System *

« previous php.bugs (#242017) next »