-
-
Save nikic/f52bd4b3c9ab12e5cee1eb89ae13f351 to your computer and use it in GitHub Desktop.
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 b3d8854f837bc521c468d7326922751ca5a31606 | |
Author: Nikita Popov <nikita.ppv@gmail.com> | |
Date: Mon Dec 30 16:59:05 2019 +0100 | |
Fixed bug #79037 | |
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_big5.c b/ext/mbstring/libmbfl/filters/mbfilter_big5.c | |
index 0fc57d62b1..6c071e0e99 100644 | |
--- a/ext/mbstring/libmbfl/filters/mbfilter_big5.c | |
+++ b/ext/mbstring/libmbfl/filters/mbfilter_big5.c | |
@@ -145,10 +145,10 @@ static unsigned short cp950_pua_tbl[][4] = { | |
static inline int is_in_cp950_pua(int c1, int c) { | |
if ((c1 >= 0xfa && c1 <= 0xfe) || (c1 >= 0x8e && c1 <= 0xa0) || | |
(c1 >= 0x81 && c1 <= 0x8d) || (c1 >= 0xc7 && c1 <= 0xc8)) { | |
- return (c > 0x39 && c < 0x7f) || (c > 0xa0 && c < 0xff); | |
+ return (c >=0x40 && c <= 0x7e) || (c >= 0xa1 && c <= 0xfe); | |
} | |
if (c1 == 0xc6) { | |
- return c > 0xa0 && c < 0xff; | |
+ return c >= 0xa1 && c <= 0xfe; | |
} | |
return 0; | |
} | |
diff --git a/ext/mbstring/tests/bug79037.phpt b/ext/mbstring/tests/bug79037.phpt | |
new file mode 100644 | |
index 0000000000..94ff01a4a1 | |
--- /dev/null | |
+++ b/ext/mbstring/tests/bug79037.phpt | |
@@ -0,0 +1,10 @@ | |
+--TEST-- | |
+Bug #79037: global buffer-overflow in `mbfl_filt_conv_big5_wchar` | |
+--FILE-- | |
+<?php | |
+ | |
+var_dump(mb_convert_encoding("\x81\x3a", "UTF-8", "CP950")); | |
+ | |
+?> | |
+--EXPECT-- | |
+string(1) "?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment