From 9d81d7ff70657554f3524b5728cfb1db0ae5a4ae Mon Sep 17 00:00:00 2001 From: Masaki Kagaya Date: Wed, 18 Feb 2015 23:17:39 +0900 Subject: [PATCH] added missing parentheses added test case for bug #68846 replaced tab with space added missing parentheses again See also: http://icu-project.org/docs/papers/gb18030.html#h7 --- ext/mbstring/libmbfl/filters/mbfilter_gb18030.c | 2 +- ext/mbstring/tests/bug68846.phpt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 ext/mbstring/tests/bug68846.phpt diff --git a/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c b/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c index a5ead7a693..721c16292b 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_gb18030.c @@ -239,7 +239,7 @@ mbfl_filt_conv_gb18030_wchar(int c, mbfl_convert_filter *filter) if (((c1 >= 0x81 && c1 <= 0x84) || (c1 >= 0x90 && c1 <= 0xe3)) && c2 >= 0x30 && c2 <= 0x39 && c3 >= 0x81 && c3 <= 0xfe && c >= 0x30 && c <= 0x39) { if (c1 >= 0x90 && c1 <= 0xe3) { - w = ((c1 - 0x90)*10 + (c2 - 0x30)*126 + (c3 - 0x81))*10 + (c - 0x30) + 0x10000; + w = ((((c1 - 0x90)*10 + (c2 - 0x30))*126 + (c3 - 0x81)))*10 + (c - 0x30) + 0x10000; } else { /* Unicode BMP */ w = (((c1 - 0x81)*10 + (c2 - 0x30))*126 + (c3 - 0x81))*10 + (c - 0x30); if (w >= 0 && w <= 39419) { diff --git a/ext/mbstring/tests/bug68846.phpt b/ext/mbstring/tests/bug68846.phpt new file mode 100644 index 0000000000..1b43e3d11b --- /dev/null +++ b/ext/mbstring/tests/bug68846.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #68846 False detection of CJK Unified Ideographs Extension E +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) \ No newline at end of file -- 2.40.0