jani                                     Tue, 04 Aug 2009 02:56:26 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=286783

Log:
- Fixed bug #48768 (parse_ini_*() crash with INI_SCANNER_RAW)

Bug: http://bugs.php.net/48768 (Verified) parse_ini_*() crash with 
INI_SCANNER_RAW
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
    A   
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug48768.phpt
    U   php/php-src/trunk/Zend/zend_ini_scanner.l
    A   php/php-src/trunk/ext/standard/tests/general_functions/bug48768.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-08-04 02:55:24 UTC (rev 286782)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-08-04 02:56:26 UTC (rev 286783)
@@ -68,6 +68,7 @@
   (Sriram Natarajan)
 - Fixed bug #48771 (rename() between volumes fails and reports no error on
   Windows). (Pierre)
+- Fixed bug #48768 (parse_ini_*() crash with INI_SCANNER_RAW). (Jani)
 - Fixed bug #48763 (ZipArchive produces corrupt archive). (dani dot church at
   gmail dot com, Pierre)
 - Fixed bug #48762 (IPv6 address filter still rejects valid address). (Felipe)

Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l        2009-08-04 
02:55:24 UTC (rev 286782)
+++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l        2009-08-04 
02:56:26 UTC (rev 286783)
@@ -315,7 +315,7 @@

 SECTION_RAW_CHARS [^\]\n\r]
 SINGLE_QUOTED_CHARS [^']
-RAW_VALUE_CHARS [^=\n\r;]
+RAW_VALUE_CHARS [^\n\r;]

 LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
 VALUE_CHARS         ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})

Added: 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug48768.phpt
===================================================================
--- 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug48768.phpt 
                            (rev 0)
+++ 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug48768.phpt 
    2009-08-04 02:56:26 UTC (rev 286783)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48768 (parse_ini_*() crashes with INI_SCANNER_RAW)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48768.tmp';
+
+// Build ini data
+$ini_data = <<< EOT
+equal = "="
+
+EOT;
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48768.tmp'); ?>
+--EXPECT--
+array(1) {
+  ["equal"]=>
+  string(1) "="
+}
+array(1) {
+  ["equal"]=>
+  string(1) "="
+}

Modified: php/php-src/trunk/Zend/zend_ini_scanner.l
===================================================================
--- php/php-src/trunk/Zend/zend_ini_scanner.l   2009-08-04 02:55:24 UTC (rev 
286782)
+++ php/php-src/trunk/Zend/zend_ini_scanner.l   2009-08-04 02:56:26 UTC (rev 
286783)
@@ -315,7 +315,7 @@

 SECTION_RAW_CHARS [^\]\n\r]
 SINGLE_QUOTED_CHARS [^']
-RAW_VALUE_CHARS [^=\n\r;]
+RAW_VALUE_CHARS [^\n\r;]

 LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
 VALUE_CHARS         ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})

Added: php/php-src/trunk/ext/standard/tests/general_functions/bug48768.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/general_functions/bug48768.phpt        
                        (rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/bug48768.phpt        
2009-08-04 02:56:26 UTC (rev 286783)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #48768 (parse_ini_*() crashes with INI_SCANNER_RAW)
+--FILE--
+<?php
+
+$ini_location = dirname(__FILE__) . '/bug48768.tmp';
+
+// Build ini data
+$ini_data = <<< EOT
+equal = "="
+
+EOT;
+
+// Save ini data to file
+file_put_contents($ini_location, $ini_data);
+
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_RAW));
+var_dump(parse_ini_file($ini_location, false, INI_SCANNER_NORMAL));
+
+?>
+--CLEAN--
+<?php @unlink(dirname(__FILE__) . '/bug48768.tmp'); ?>
+--EXPECT--
+array(1) {
+  [u"equal"]=>
+  unicode(1) "="
+}
+array(1) {
+  [u"equal"]=>
+  unicode(1) "="
+}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to