From f456fffe045a93b6b47ed501876fdc97c234a8ff Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Mon, 16 Feb 2009 01:58:16 +0000 Subject: [PATCH] - MFH: Fix bug #47399 mb_check_encoding() return true for some illegal SJIS characrters. --- NEWS | 2 ++ ext/mbstring/libmbfl/filters/mbfilter_cp932.c | 2 +- ext/mbstring/libmbfl/filters/mbfilter_sjis.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index a3160413e0..e390f241e3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Feb 2009, PHP 5.2.9 +- Fixed bug #47399 (mb_check_encoding() returns true for some illegal SJIS + characters). (for-bugs at hnw dot jp, Moriyoshi) - Fixed bug #45923 (mb_st[r]ripos() offset not handled correctly). (Moriyoshi) - Fixed bug #43841 (mb_strrpos() offset is byte count for negative values). (Moriyoshi) diff --git a/ext/mbstring/libmbfl/filters/mbfilter_cp932.c b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c index 80f7bfbc6b..8fa254b6ce 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_cp932.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_cp932.c @@ -167,7 +167,7 @@ mbfl_filt_conv_sjiswin_wchar(int c, mbfl_convert_filter *filter) case 1: /* kanji second char */ filter->status = 0; c1 = filter->cache; - if (c > 0x39 && c < 0xfd && c != 0x7f) { + if (c >= 0x40 && c <= 0xfc && c != 0x7f) { w = 0; SJIS_DECODE(c1, c, s1, s2); s = (s1 - 0x21)*94 + s2 - 0x21; diff --git a/ext/mbstring/libmbfl/filters/mbfilter_sjis.c b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c index f9d7ff671d..83ef565927 100644 --- a/ext/mbstring/libmbfl/filters/mbfilter_sjis.c +++ b/ext/mbstring/libmbfl/filters/mbfilter_sjis.c @@ -167,7 +167,7 @@ mbfl_filt_conv_sjis_wchar(int c, mbfl_convert_filter *filter) case 1: /* kanji second char */ filter->status = 0; c1 = filter->cache; - if (c > 0x39 && c < 0xfd && c != 0x7f) { + if (c >= 0x40 && c <= 0xfc && c != 0x7f) { SJIS_DECODE(c1, c, s1, s2); w = (s1 - 0x21)*94 + s2 - 0x21; if (w >= 0 && w < jisx0208_ucs_table_size) { -- 2.50.1