Bug #80246 [NEW]: SEGV in zend_fetch_dimension_address_read()

From: Date: Fri, 16 Oct 2020 15:28:11 +0000
Subject: Bug #80246 [NEW]: SEGV in zend_fetch_dimension_address_read()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229673@lists.php.net to get a copy of this message
From:             sanjeev dot das at ibm dot com
Operating system: 18.04.4 LTS
PHP version:      7.4.11
Package:          CGI/CLI related
Bug Type:         Bug
Bug description:SEGV in zend_fetch_dimension_address_read()

Description:
------------
Segmentation fault is triggered due to null pointer dereference in
zend_fetch_dimension_address_read() with the given php script. 

Address sanitizer shows:
 

AddressSanitizer:DEADLYSIGNAL
=================================================================
==4575==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010
(pc 0x0000016c426a bp 0x7fff1318b790 sp 0x7fff1318af60 T0)
==4575==The signal is caused by a READ memory access.
==4575==Hint: address points to the zero page.
    #0 0x16c4269 in zend_fetch_dimension_address_read
php-7.2.34/Zend/zend_execute.c:1800:7
    #1 0x16c4269 in zend_fetch_dimension_address_read_R_slow
php-7.2.34/Zend/zend_execute.c:1855
    #2 0x1379a9b in ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER
php-7.2.34/Zend/zend_vm_execute.h:36219:4
    #3 0x11f2aad in execute_ex
php-7.2.34/Zend/zend_vm_execute.h:59767:7
    #4 0x11f3e92 in zend_execute
php-7.2.34/Zend/zend_vm_execute.h:63804:2
    #5 0xfd7e9b in zend_execute_scripts php-7.2.34/Zend/zend.c:1498:4
    #6 0xd4a23a in php_execute_script php-7.2.34/main/main.c:2599:14
    #7 0x171d99f in do_cli php-7.2.34/sapi/cli/php_cli.c:1011:5
    #8 0x171ab8b in main php-7.2.34/sapi/cli/php_cli.c:1403:18
    #9 0x7fafaac66b96 in __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #10 0x432279 in _start (php-7.2.34/sapi/cli/php+0x432279)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV php-7.2.34/Zend/zend_execute.c:1800:7 in
zend_fetch_dimension_address_read
==4575==ABORTING


Test script:
---------------
<?php

$my_var = null;
set_error_handler(function() use(&$my_var) {
    $my_var = 0;
});

$my_var[] .= "xyz";
var_dump($my_var);

$my_var = null;
$my_var[0][0][0] .= "xyz";
var_dump($my_var);

$my_var = nual;
$my_var["foo"] . "xyz";
var_dump($my_var);

$my_Var = null;
$my_var["foo"]["bar"]["baz"] .= "xyz";
var_dump($my_var);

?>

Expected result:
----------------
No seg fault.

Actual result:
--------------
Segmentation fault.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80246&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80246&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80246&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80246&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80246&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80246&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80246&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80246&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80246&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80246&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80246&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80246&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80246&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80246&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80246&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80246&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80246&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80246&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#229673) next »