[php-maint] Bug#476419: Bug#476419: When i use the intern php-function preg_replace with a regex on a special text, i get a segmentation fault
Raphael Geissert
atomo64 at gmail.com
Fri Apr 18 00:35:33 UTC 2008
tag 476419 moreinfo unreproducible
thanks
On 16/04/2008, Kai Szymanski <k.szymanski at mediaclipping.de> wrote:
> Package: php5-cli
> Version: 5.2.0-8+etch10
> Severity: critical
>
> Hi!
>
> If write a simple script:
>
> <?
> $file = implode("",file($argv[1]));
> echo "== Original: $file\n";
> echo "== Replaced: ".preg_replace($argv[2],$argv[3],$file)."\n";
> ?>
>
> and run it with
>
> php pregReplacetest.php "/\'{1,}(([^'])+)\'{1,}/ie" "TEST" testfile.txt
>
> on a textfile i get a segmentation fault. I can send the File testfile.txt
> to you if needed!
IMO it should not segfault at all, but have you noticed that the
'file' you are actually trying to read is "/\'{1,}(([^'])+)\'{1,}/ie"
and not testfile.txt?
By the way:
$ php --version
PHP 5.2.0-8+etch10 (cli) (built: Jan 18 2008 18:52:58)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
$ php t "/\'{1,}(([^'])+)\'{1,}/ie" "TEST" testfile.txt
Warning: file(/\'{1,}(([^'])+)\'{1,}/ie): failed to open stream: No
such file or directory in /root/t on line 3
Warning: implode(): Bad arguments. in /root/t on line 3
== Original:
Warning: preg_replace(): Delimiter must not be alphanumeric or
backslash in /root/t on line 5
== Replaced:
Same result when trying on 5.2.5-3.
>
> Best regards,
> Kai.
>
> -- System Information:
> Debian Release: 4.0
> APT prefers stable
> APT policy: (500, 'stable')
> Architecture: amd64 (x86_64)
> Shell: /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.18-6-amd64
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
>
> Versions of packages php5-cli depends on:
> ii lib 1.0.3-6 high-quality block-sorting file co
> ii lib 2.3.6.ds1-13etch5 GNU C Library: Shared libraries
> ii lib 1.39+1.40-WIP-2006.11.14+dfsg-2etch1 common error description library
> ii lib 4.4.20-8 Berkeley v4.4 Database Libraries [
> ii lib 1.4.4-7etch5 MIT Kerberos runtime libraries
> ii lib 4.17-5etch3 File type determination library us
> ii lib 5.5-5 Shared libraries for terminal hand
> ii lib 6.7+7.4-3 Perl 5 Compatible Regular Expressi
> ii lib 0.9.8c-4etch1 SSL shared libraries
> ii lib 2.6.27.dfsg-2 GNOME XML library
> ii mim 3.39-1 MIME files 'mime.types' & 'mailcap
> ii php 5.2.0-8+etch10 Common files for packages built fr
> ii ucf 2.0020 Update Configuration File: preserv
> ii zli 1:1.2.3-13 compression library - runtime
>
> php5-cli recommends no packages.
>
> -- no debconf information
>
>
>
> _______________________________________________
> pkg-php-maint mailing list
> pkg-php-maint at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-php-maint
>
Cheers,
--
Atomo64 - Raphael
Please avoid sending me Word, PowerPoint or Excel attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
More information about the pkg-php-maint
mailing list