|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17786 Coredump on \\0 backref (011.phpt)
Submitted: 2002-06-16 11:02 UTC Modified: 2002-06-17 18:57 UTC
From: msopacua at idg dot nl Assigned:
Status: Closed Package: Regexps related
PHP Version: 4.0CVS-2002-06-16 OS: BSD/OS 4.2
Private report: No CVE-ID: None
 [2002-06-16 11:02 UTC] msopacua at idg dot nl
Make test creates a coredump in ext/standard/tests/regex/011.phpt

Compiled with --enable-debug but not much info:
(gdb) bt
#0  0x4893760f in memcpy () from /shlib/
#1  0x8153584 in ?? ()
#2  0x8153b95 in ?? ()
#3  0x8153ce0 in ?? ()
#4  0x81c8f5a in ?? ()
#5  0x81b853b in ?? ()
#6  0x8189a11 in ?? ()
#7  0x81ce7fb in ?? ()
#8  0x806e40e in ?? ()

The core was created when run from the debugger, with the -e option set through set args.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 11:17 UTC] msopacua at idg dot nl
I also tested sed to see if it's the system supplied regex library, but that's all ok:
$ echo "abc123" | sed -e "s|123|def\0ghi|g"

$ echo "abc123" | sed -e "s|123|def\\0ghi|g"

$ echo "abc123" | sed -e "s|123|def\\\0ghi|g"

$ echo "abc123" | sed -e "s|123|def\\\\0ghi|g"
 [2002-06-16 11:31 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2002-06-16 12:11 UTC] msopacua at idg dot nl

Unless you have some tips, not covered in the generate backtrace links, the problem only occurs with the CLI - I cannot reproduce it in apache.

As said:
I've compiled php with --enable-debug, used:
gdb -exec sapi/cli/php -core ./php.core

gdb sapi/cli/php
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-bsdi4.2"...
(gdb) set args -e -c /chroot/home/mdev/php4-200206160300/php.ini-dist -f /chroot/home/mdev/php4-200206160300/run-tests.php
(gdb) set environment TEST_PHP_EXECUTABLE=/chroot/home/mdev/php4-200206160300/sapi/cli/php
(gdb) run
Starting program: /chroot/home/mdev/php4-200206160300/sapi/cli/php -e -c /chroot/home/mdev/php4-200206160300/php.ini-dist -f /chroot/home/mdev/php4-200206160300/run-tests.php
 [2002-06-16 12:14 UTC]
CLI ist just fine, it's even easier to debug. But I think your last submit missed the output of BT unless I'm missing something?
 [2002-06-16 12:25 UTC] msopacua at idg dot nl
Heck - this is even more complicated.
If I take the 'FILE' section in 011.phpt and put it in 011.php, then use:
$ /chroot/home/mdev/php4-200206160300/sapi/cli/php -e -f ./011.php

all is fine. With make test it failes.
The output of gdb is complete, just in case, here it is again:
---Type <return> to continue, or q <return> to quit---
#0  0x486b660f in memcpy () from /shlib/
(gdb) bt
#0  0x486b660f in memcpy () from /shlib/
#1  0x814ed64 in ?? ()
#2  0x814f375 in ?? ()
#3  0x814f4c0 in ?? ()
#4  0x81c473a in ?? ()
#5  0x81b3d1b in ?? ()
#6  0x81851f1 in ?? ()
#7  0x81c9fdb in ?? ()
#8  0x806d8ce in ?? ()

I've also topped make test while running, to see if I go through any shell limits, but php doesn't even go above 5 Megs and I can take 384 Meg in this shell.
 [2002-06-16 12:27 UTC]
Did you compile using --with-regex=system?  That is known to be broken on some platforms.
 [2002-06-16 12:41 UTC] msopacua at idg dot nl
Nope, no regex config flag at all. So the php default is used.

Oh - and since it forks off another CLI executable, I can't get to that one in gdb - tried 'set follow-fork-mode ask', but doesn't help a bit.
 [2002-06-16 15:19 UTC]
Dupe of #15829.
Please compile PHP with --enable-debug and provide a backtrace and post it on #15829.
 [2002-06-16 15:26 UTC] msopacua at idg dot nl
1) How did you find it - oh you posted it. I tried \0 in ALL categories and it didn't yield any results. Searching the database needs improvement.

2) I did compile with --enable-debug and I gave a backtrace.
 [2002-06-17 18:57 UTC]
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at In case this was a documentation 
problem, the fix will show up soon at
In case this was a website problem, the change will show
up on the site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 22:01:30 2024 UTC