From:             sthapa at site5 dot com
Operating system: Linux
PHP version:      5.1.2
PHP Bug Type:     Strings related
Bug description:  is_utf8 reliably  crashes on text input

Description:
------------
is_utf8() crashes on text

Reproduce code:
---------------
<?php
echo "Start Test, the data follows.<br><br>\n";
if ($fp = fopen("text.txt", "r")) {
   $contents = fread($fp, filesize("text.txt"));
   echo "$contents";
   fclose($fp);
}
echo "\n<br><br>The data is about to be passed to preg_match(). If you do
not see the word 'Success' after this line, the program has
crashed.<br>\n";
$truefalsetest=preg_match('%^(?:
         [\x09\x0A\x0D\x20-\x7E]            # ASCII
       | [\xC2-\xDF][\x80-\xBF]            # non-overlong 2-byte
       |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
       | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
       |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
       |  \xF0[\x90-\xBF][\x80-\xBF]{2}    # planes 1-3
       | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
       |  \xF4[\x80-\x8F][\x80-\xBF]{2}    # plane 16
   )*$%xs', $contents);
echo "Success. Return value of preg_match() = $truefalsetest.";
?>


Expected result:
----------------
Output with the success message.  Error appears when using either php
5.1.1 or php 4.4.2 both using suExec.  Testing this on freebsd systems
don't cause the crash and do work correctly.

Actual result:
--------------
Core file and output doesn't have the success message. 

[EMAIL PROTECTED] [/user/dir]# gdb php5.bin core.11662
GNU gdb Red Hat Linux (6.3.0.0-1.63rh)
Copyright 2004 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-redhat-linux-gnu"...php5.bin: No such
file or directory.

Core was generated by `php5.bin'.
Program terminated with signal 11, Segmentation fault.
#0  0x080a5c4c in ?? ()
(gdb) bt
#0  0x080a5c4c in ?? ()
Error accessing memory address 0xbf523ef0: No such file or directory.


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

Reply via email to