OLD | NEW |
| (Empty) |
1 Index: source/i18n/csrucode.cpp | |
2 =================================================================== | |
3 --- source/i18n/csrucode.cpp (revision 214189) | |
4 +++ source/i18n/csrucode.cpp (working copy) | |
5 @@ -31,8 +31,9 @@ | |
6 int32_t CharsetRecog_UTF_16_BE::match(InputText* textIn) | |
7 { | |
8 const uint8_t *input = textIn->fRawInput; | |
9 + int32_t length = textIn->fRawLength; | |
10 | |
11 - if (input[0] == 0xFE && input[1] == 0xFF) { | |
12 + if (length >=2 && input[0] == 0xFE && input[1] == 0xFF) { | |
13 return 100; | |
14 } | |
15 | |
16 @@ -53,8 +54,9 @@ | |
17 int32_t CharsetRecog_UTF_16_LE::match(InputText* textIn) | |
18 { | |
19 const uint8_t *input = textIn->fRawInput; | |
20 + int32_t length = textIn->fRawLength; | |
21 | |
22 - if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] !
= 0x00)) { | |
23 + if (length >= 4 && input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x0
0 || input[3] != 0x00)) { | |
24 return 100; | |
25 } | |
26 | |
27 @@ -76,7 +78,7 @@ | |
28 bool hasBOM = FALSE; | |
29 int32_t confidence = 0; | |
30 | |
31 - if (getChar(input, 0) == 0x0000FEFFUL) { | |
32 + if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) { | |
33 hasBOM = TRUE; | |
34 } | |
35 | |
OLD | NEW |