-
-
Save anonymous/dba0092056c3cfa490e549e07a6cb92d to your computer and use it in GitHub Desktop.
Patch for 72241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 97eff7eb57fc2320c267a949cffd622c38712484 | |
Author: Stanislav Malyshev <stas@php.net> | |
Date: Sun May 22 17:49:02 2016 -0700 | |
Fix bug #72241: get_icu_value_internal out-of-bounds read | |
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c | |
index c8159bc..31f60b3 100644 | |
--- a/ext/intl/locale/locale_methods.c | |
+++ b/ext/intl/locale/locale_methods.c | |
@@ -326,6 +326,7 @@ static char* get_icu_value_internal( const char* loc_name , char* tag_name, int* | |
if( U_FAILURE( status ) ) { | |
if( status == U_BUFFER_OVERFLOW_ERROR ) { | |
status = U_ZERO_ERROR; | |
+ buflen++; /* add space for \0 */ | |
continue; | |
} | |
diff --git a/ext/intl/tests/bug72241.phpt b/ext/intl/tests/bug72241.phpt | |
new file mode 100644 | |
index 0000000..397e1e7 | |
--- /dev/null | |
+++ b/ext/intl/tests/bug72241.phpt | |
@@ -0,0 +1,14 @@ | |
+--TEST-- | |
+Bug #72241: get_icu_value_internal out-of-bounds read | |
+--SKIPIF-- | |
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> | |
+--FILE-- | |
+<?php | |
+$var1=str_repeat("A", 1000); | |
+$out = locale_get_primary_language($var1); | |
+echo strlen($out) . PHP_EOL; | |
+echo unpack('H*', $out)[1] . PHP_EOL; | |
+--EXPECT-- | |
+1000 | |
+61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment