[PHP-dev 885]Re: mb_ereg_replaceについて

HOTTA Michihide hotta @ net-newbie.com
2003年 9月 20日 (土) 09:40:47 JST


堀田です。

On Sat, 20 Sep 2003 08:51:01 +0900 
Subject [PHP-dev 884] mb_ereg_replaceについて
komura <komura @ ma9.seikyou.ne.jp> wrote:

> また、マルチバイト正規表現の処理に oniguruma が組み込まれている、
> CVS 版の php5-200309180130 でも試してみましたが、Segmentation fault を
> 起こします。
> 
> $ php -v
> PHP 5.0.0b2-dev (cli) (built: Sep 18 2003 17:01:41)
> Copyright (c) 1997-2003 The PHP Group
> Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies
> 
> $ php -r 'mb_ereg_replace( "C*$", "Z", "ABC" );'
> セグメンテーション違反です

とりあえず再現しましたのでご報告します。
20030912頃のスナップショットです。

hotta @ vm_seed ~$ ulimit -c unlimited
hotta @ vm_seed ~$ php-cli -v
PHP 5.0.0b2-dev (cli) (built: Sep 12 2003 17:00:42) (DEBUG)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies
hotta @ vm_seed ~$ php-cli -r  'mb_ereg_replace( "C*$", "Z", "ABC" );'
hotta @ vm_seed ~$ gdb `which php-cli` core.8169
GNU gdb 5.2.1
Copyright 2002 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-vine-linux"...
Core was generated by `php-cli -r mb_ereg_replace( "C*$", "Z", "ABC" );'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/libxml2.so.2...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x40265b7b in memcpy (dstpp=0x4032598d, srcpp=0x4032590c, len=4294967292)
    at ../sysdeps/generic/memcpy.c:55
55  ../sysdeps/generic/memcpy.c: No such file or directory.
    in ../sysdeps/generic/memcpy.c
(gdb) bt
#0  0x40265b7b in memcpy (dstpp=0x4032598d, srcpp=0x4032590c, len=4294967292)
    at ../sysdeps/generic/memcpy.c:55
#1  0x0808d7ab in _php_mb_regex_ereg_replace_exec (ht=3, return_value=0x40325944, this_ptr=0x0,
    return_value_used=0, option=12) at /usr/local/src/php-src/ext/mbstring/php_mbregex.c:656
#2  0x0808d9fc in zif_mb_ereg_replace (ht=3, return_value=0x40325944, this_ptr=0x0,
    return_value_used=0) at /usr/local/src/php-src/ext/mbstring/php_mbregex.c:683
#3  0x081ef710 in zend_do_fcall_common_helper (execute_data=0xbffff6a0, op_array=0x40325288)
    at /usr/local/src/php-src/Zend/zend_execute.c:2541
#4  0x081efd95 in zend_do_fcall_handler (execute_data=0xbffff6a0, op_array=0x40325288)
    at /usr/local/src/php-src/Zend/zend_execute.c:2687
#5  0x081ec37a in execute (op_array=0x40325288) at /usr/local/src/php-src/Zend/zend_execute.c:1267
#6  0x081c580b in zend_eval_string (str=0xbffffaae "mb_ereg_replace( \"C*$\", \"Z\", \"ABC\" );",
    retval_ptr=0x0, string_name=0x837f354 "Command line code")
    at /usr/local/src/php-src/Zend/zend_execute_API.c:853
#7  0x081c5983 in zend_eval_string_ex (
    str=0xbffffaae "mb_ereg_replace( \"C*$\", \"Z\", \"ABC\" );", retval_ptr=0x0,
    string_name=0x837f354 "Command line code", handle_exceptions=1)
    at /usr/local/src/php-src/Zend/zend_execute_API.c:891
#8  0x081f781c in main (argc=3, argv=0xbffff974) at /usr/local/src/php-src/sapi/cli/php_cli.c:949
#9  0x40203e85 in __libc_start_main (main=0x81f6cce <main>, argc=3, ubp_av=0xbffff974,
    init=0x81f83a0 <__libc_csu_init>, fini=0x81f83d0 <__libc_csu_fini>,
    rtld_fini=0x400130a0 <_rtld_local>, stack_end=0x4032598d)
    at ../sysdeps/generic/libc-start.c:223
(gdb) q

-- 
堀田 倫英 <hotta @ net-newbie.com> <http://www.net-newbie.com>


PHP-dev メーリングリストの案内