#40706 [NEW]: preg_match crash

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40706 [NEW]: preg_match crash

    From: askold2 at velo dot nsk dot ru
    Operating system: any
    PHP version: 4.4.6
    PHP Bug Type: PCRE related
    Bug description: preg_match crash

    Description:
    ------------
    the regular expression like ((any text)*(other text)*)* produce the hang
    or crash of PHP program. In the previous versions of php all worked
    properly.

    Reproduce code:
    ---------------
    $subj="sdfgsdg";
    if(preg_match('/^((a)*(b)*)*$/',$subj))
    echo "match";
    else
    echo "not match";


    Expected result:
    ----------------
    "match" or "not match" printing


    Actual result:
    --------------
    nothing. the hung of script on my unux hosting and breaking program in
    windows

    --
    Edit bug report at [url]http://bugs.php.net/?id=40706&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40706&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40706&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40706&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40706&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40706&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40706&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40706&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40706&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40706&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40706&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40706&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40706&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40706&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40706&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40706&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40706&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40706&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40706&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40706&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40706&r=mysqlcfg[/url]
    askold2 at velo dot nsk dot ru Guest

  2. Similar Questions and Discussions

    1. InDesign CS CE non-stop CRASH, CRASH, CRASH, CRASH, CRASH, CRASH
      Sofware is orig., and OS is win2000 pro, or 2003 server or win2000 server. Any doc with litle more text crash indesign non-stop. With any updates...
    2. preg_match
      Hello, I would like to split a String containing ingredience with additional assigned footnotes... my problem I only get the first ingredience...
    3. preg_match allowing a-z AND å ä ö ü
      I've been searching the net and Google news groups for a preg_match expression that will return true on strings containing (uppercase and...
    4. preg_match VS preg_match_all
      I'm wondering if someone can explain why the following works with preg_match_all, but not preg_match: $html = "product=3456789&" ...
    5. preg_match bug
      Hey I wanted to see if anyone was getting the same problem. Using preg_match in the following pattern: "/<tr bgcolor="#FFFFFF">(.|\n)+?<\/tr>/" ...
  3. #2

    Default #40706 [Com]: preg_match crash

    ID: 40706
    Comment by: bmihelac at mihelac dot org
    Reported By: askold2 at velo dot nsk dot ru
    Status: Open
    Bug Type: PCRE related
    Operating System: any
    PHP Version: 4.4.6
    New Comment:

    I have similiar problem both on linux and windows. On windows it
    crashes PHP without any error notices. I am not sure if it crash PHP on
    linux/unix.

    Seems that regex with nested parenthesizes are especially vunerable,
    for example:
    $pattern = '/"([^"\\\\]*(?:(?:\\\\.)*[^"\\\\]*)*)"/';


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-03-03 15:12:45] askold2 at velo dot nsk dot ru

    Description:
    ------------
    the regular expression like ((any text)*(other text)*)* produce the
    hang or crash of PHP program. In the previous versions of php all
    worked properly.

    Reproduce code:
    ---------------
    $subj="sdfgsdg";
    if(preg_match('/^((a)*(b)*)*$/',$subj))
    echo "match";
    else
    echo "not match";


    Expected result:
    ----------------
    "match" or "not match" printing


    Actual result:
    --------------
    nothing. the hung of script on my unux hosting and breaking program in
    windows


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40706&edit=1[/url]
    bmihelac at mihelac dot org Guest

  4. #3

    Default #40706 [Opn->Bgs]: preg_match crash

    ID: 40706
    Updated by: [email]tony2001@php.net[/email]
    Reported By: askold2 at velo dot nsk dot ru
    -Status: Open
    +Status: Bogus
    Bug Type: PCRE related
    Operating System: any
    PHP Version: 4.4.6
    New Comment:

    We can't fix PCRE stack overflow (it's not PHP problem anyway), but we
    have a workaround for it in PHP5.
    Please consider upgrading.


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-03-04 13:47:46] bmihelac at mihelac dot org

    I have similiar problem both on linux and windows. On windows it
    crashes PHP without any error notices. I am not sure if it crash PHP on
    linux/unix.

    Seems that regex with nested parenthesizes are especially vunerable,
    for example:
    $pattern = '/"([^"\\\\]*(?:(?:\\\\.)*[^"\\\\]*)*)"/';

    ------------------------------------------------------------------------

    [2007-03-03 15:12:45] askold2 at velo dot nsk dot ru

    Description:
    ------------
    the regular expression like ((any text)*(other text)*)* produce the
    hang or crash of PHP program. In the previous versions of php all
    worked properly.

    Reproduce code:
    ---------------
    $subj="sdfgsdg";
    if(preg_match('/^((a)*(b)*)*$/',$subj))
    echo "match";
    else
    echo "not match";


    Expected result:
    ----------------
    "match" or "not match" printing


    Actual result:
    --------------
    nothing. the hung of script on my unux hosting and breaking program in
    windows


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40706&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139