# Segfault in HEAD

- Thread: https://externals.io/message/6254
- Original archive: https://news-web.php.net/php.internals/6254
- Started by Andrey Hristov on 2003-12-06T16:42:11+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #6254 — Andrey Hristov — 2003-12-06T16:42:11+00:00

URL: https://externals.io/message/6254#6254

Hi,
the following script segfaults when HEAD is used (no problem with PHP_4_3).
<?php
$s = "FUBAR";
$s[0][] = 1;
?>

Here is a session that shows the script and the error spotted by valgrind.
[session]

bash-2.05b$ cat soffset.php
<?php
$s = "FUBAR";
$s[0][] = 1;
?>
bash-2.05b$ valgrind ./php soffset.php
==4985== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==4985== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==4985== Using valgrind-2.0.0, a program supervision framework for 
x86-linux.
==4985== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==4985== Estimated CPU clock rate is 300 MHz
==4985== For more details, rerun with: -v
==4985==
==4985== Invalid read of size 4
==4985==    at 0x814C3E3: zend_assign_dim_handler (zend_execute.c:2069)
==4985==    by 0x814A22E: execute (zend_execute.c:1273)
==4985==    by 0x812C1EA: zend_execute_scripts (zend.c:1016)
==4985==    by 0x80F221B: php_execute_script (main.c:1625)
==4985==    Address 0x0 is not stack'd, malloc'd or free'd
Segmentation fault
bash-2.05b$ ../4_3/php soffset.php
bash-2.05b$

[/session]

Regards,
Andrey

---

## #6263 — Jani Taskinen — 2003-12-07T10:31:33+00:00

URL: https://externals.io/message/6254#6263 · In reply to: #6254

Please add this as one regression test..there are never too many
    of these. (If it doesn't already exist)
    
    --Jani



>Hi,
>the following script segfaults when HEAD is used (no problem with PHP_4_3).
><?php
>$s = "FUBAR";
>$s[0][] = 1;
>?>
>
>Here is a session that shows the script and the error spotted by valgrind.
>[session]
>
>bash-2.05b$ cat soffset.php
><?php
>$s = "FUBAR";
>$s[0][] = 1;
>?>
>bash-2.05b$ valgrind ./php soffset.php
>==4985== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
>==4985== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
>==4985== Using valgrind-2.0.0, a program supervision framework for 
>x86-linux.
>==4985== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
>==4985== Estimated CPU clock rate is 300 MHz
>==4985== For more details, rerun with: -v
>==4985==
>==4985== Invalid read of size 4
>==4985==    at 0x814C3E3: zend_assign_dim_handler (zend_execute.c:2069)
>==4985==    by 0x814A22E: execute (zend_execute.c:1273)
>==4985==    by 0x812C1EA: zend_execute_scripts (zend.c:1016)
>==4985==    by 0x80F221B: php_execute_script (main.c:1625)
>==4985==    Address 0x0 is not stack'd, malloc'd or free'd
>Segmentation fault
>bash-2.05b$ ../4_3/php soffset.php
>bash-2.05b$
>
>[/session]
>
>Regards,
>Andrey

---

## #7695 — Andi Gutmans — 2004-02-10T11:39:05+00:00

URL: https://externals.io/message/6254#7695 · In reply to: #6254

Fixed.

At 05:42 PM 12/6/2003 +0100, Andrey Hristov wrote:
>Hi,
>the following script segfaults when HEAD is used (no problem with PHP_4_3).
><?php
>$s = "FUBAR";
>$s[0][] = 1;
>?>
>
>Here is a session that shows the script and the error spotted by valgrind.
>[session]
>
>bash-2.05b$ cat soffset.php
><?php
>$s = "FUBAR";
>$s[0][] = 1;
>?>
>bash-2.05b$ valgrind ./php soffset.php
>==4985== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
>==4985== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
>==4985== Using valgrind-2.0.0, a program supervision framework for x86-linux.
>==4985== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
>==4985== Estimated CPU clock rate is 300 MHz
>==4985== For more details, rerun with: -v
>==4985==
>==4985== Invalid read of size 4
>==4985==    at 0x814C3E3: zend_assign_dim_handler (zend_execute.c:2069)
>==4985==    by 0x814A22E: execute (zend_execute.c:1273)
>==4985==    by 0x812C1EA: zend_execute_scripts (zend.c:1016)
>==4985==    by 0x80F221B: php_execute_script (main.c:1625)
>==4985==    Address 0x0 is not stack'd, malloc'd or free'd
>Segmentation fault
>bash-2.05b$ ../4_3/php soffset.php
>bash-2.05b$
>
>[/session]
>
>Regards,
>Andrey
