]> granicus.if.org Git - php/commitdiff
- MFH: Fix bug #47399 mb_check_encoding() return true for some illegal SJIS
authorMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 16 Feb 2009 01:58:16 +0000 (01:58 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 16 Feb 2009 01:58:16 +0000 (01:58 +0000)
  characrters.

NEWS
ext/mbstring/libmbfl/filters/mbfilter_cp932.c
ext/mbstring/libmbfl/filters/mbfilter_sjis.c

diff --git a/NEWS b/NEWS
index a3160413e092b5af17b923d6e515b698a53e5b8f..e390f241e3c250829dbdcbe1c9da4a925a842aee 100644 (file)
--- 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)
index 80f7bfbc6bc90bb4ed423716389898ee3bafc510..8fa254b6ce08bed8bc6b709a1933ba3ecd0bee46 100644 (file)
@@ -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;
index f9d7ff671dd35023a7cd67b90bf3aea0785756fe..83ef565927d42988cc03dcdc69baadd3030005df 100644 (file)
@@ -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) {