Bug #76068 [NEW]: parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault
| From: | madboyka at yahoo dot com | Date: | Thu, 08 Mar 2018 14:26:22 +0000 |
| Subject: | Bug #76068 [NEW]: parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214236@lists.php.net to get a copy of this message | ||
From: madboyka at yahoo dot com
Operating system: Windows 10
PHP version: 7.2.3
Package: Filesystem function related
Bug Type: Bug
Bug description:parse_ini_string fails to parse "[foo]\nbar=1|>baz" with segfault
Description:
------------
Trying to parse the value "[foo]\nbar=1|>baz" with process_sections =
true and scanner_mode = INI_SCANNER_TYPED causes a segmentation fault in
the php process.
Looks like PHP sees the | as a logical operator and tries to do
something with it.
Doesn't matter whether parse_ini_string or parse_ini_file is used.
I tried this on:
Windows 10 with PHP 7.2.3
Ubuntu 16.04 with PHP 7.1.14-1+ubuntu16.04.1+deb.sury.org+1
CentOS 7.4.1708 with PHP 7.1.14
Test script:
---------------
parse_ini_string("[foo]\nbar=1|>baz",true, \INI_SCANNER_TYPED);
Expected result:
----------------
the code should run without errors and return ['foo'=> ['bar' =>
'1|>baz']]
Actual result:
--------------
produces segmentation fault
--
Edit bug report at https://bugs.php.net/bug.php?id=76068&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76068&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76068&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76068&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76068&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76068&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76068&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76068&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76068&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76068&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76068&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76068&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76068&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76068&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76068&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76068&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76068&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76068&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76068&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76068&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76068&r=mysqlcfg