icu/icu-CVE-2013-2924.patch
2013-10-30 08:30:43 +04:00

29 lines
999 B
Diff

Index: /icu/trunk/source/i18n/csrucode.cpp
===================================================================
--- /icu/trunk/source/i18n/csrucode.cpp (revision 34075)
+++ /icu/trunk/source/i18n/csrucode.cpp (revision 34076)
@@ -34,6 +34,7 @@
{
const uint8_t *input = textIn->fRawInput;
+ int32_t length = textIn->fRawLength;
- if (input[0] == 0xFE && input[1] == 0xFF) {
+ if (length >=2 && input[0] == 0xFE && input[1] == 0xFF) {
return 100;
}
@@ -58,6 +59,7 @@
{
const uint8_t *input = textIn->fRawInput;
+ int32_t length = textIn->fRawLength;
- if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
+ if (length >= 4 && input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
return 100;
}
@@ -82,5 +84,5 @@
int32_t confidence = 0;
- if (getChar(input, 0) == 0x0000FEFFUL) {
+ if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) {
hasBOM = TRUE;
}