|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-05-19 03:08 UTC] fernando at null-life dot com
[2016-05-23 00:51 UTC] stas@php.net
-Assigned To:
+Assigned To: stas
[2016-05-23 00:51 UTC] stas@php.net
[2016-05-23 00:54 UTC] stas@php.net
-PHP Version: 7.0.6
+PHP Version: 5.5.35
[2016-05-23 22:51 UTC] fernando at null-life dot com
[2016-05-24 23:30 UTC] stas@php.net
[2016-05-24 23:30 UTC] stas@php.net
-Status: Assigned
+Status: Closed
[2016-05-25 00:21 UTC] stas@php.net
[2016-05-25 03:51 UTC] stas@php.net
[2016-05-25 03:52 UTC] stas@php.net
[2016-05-25 03:53 UTC] stas@php.net
[2016-05-26 21:04 UTC] kaplan@php.net
-CVE-ID:
+CVE-ID: 2016-5093
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 03:00:01 2025 UTC |
Description: ------------ This was tested on PHP 7 with ASAN and USE_ZEND_ALLOC=0. Absence of null character causes unexpected zend_string length and leaks heap memory. The test script uses locale_get_primary_language to reach get_icu_value_internal but there are some other functions that also trigger this issue: locale_canonicalize locale_filter_matches locale_lookup locale_parse I'm attaching a possible patch for review. ------------------------------ Source code ext/intl/locale/locale_methods.c static zend_string* get_icu_value_internal( const char* loc_name , char* tag_name, int* result , int fromParseLocale) { ..... tag_value->len = strlen(tag_value->val); // strlen keeps reading after the allocated memory because there's no null terminator, and returns a value bigger than 1000 return tag_value; } Test script: --------------- <?php $var1=str_repeat("A", 1000); $out = locale_get_primary_language($var1); echo strlen($out) . PHP_EOL; echo unpack('H*', $out)[1] . PHP_EOL; Expected result: ---------------- USE_ZEND_ALLOC=0 /home/user/php-7.0/sapi/cli/php -n -dextension=/home/user/php-7.0/modules/intl.so poc.php 1000 61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 Actual result: -------------- USE_ZEND_ALLOC=0 /home/user/php-7.0/sapi/cli/php -n -dextension=/home/user/php-7.0/modules/intl.so poc.php 1006 61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161e878dcece907