Blame SOURCES/icu.10318.CVE-2013-2924_changeset_34076.patch

d2ed82
Index: /icu/trunk/source/i18n/csrucode.cpp
d2ed82
===================================================================
d2ed82
--- orig.icu/source/i18n/csrucode.cpp	(revision 34075)
d2ed82
+++ icu/source/i18n/csrucode.cpp	(revision 34076)
d2ed82
@@ -1,5 +1,5 @@
d2ed82
 /*
d2ed82
  **********************************************************************
d2ed82
- *   Copyright (C) 2005-2012, International Business Machines
d2ed82
+ *   Copyright (C) 2005-2013, International Business Machines
d2ed82
  *   Corporation and others.  All Rights Reserved.
d2ed82
  **********************************************************************
d2ed82
@@ -34,6 +34,7 @@
d2ed82
     const uint8_t *input = textIn->fRawInput;
d2ed82
     int32_t confidence = 0;
d2ed82
+    int32_t length = textIn->fRawLength;
d2ed82
 
d2ed82
-    if (input[0] == 0xFE && input[1] == 0xFF) {
d2ed82
+    if (length >=2 && input[0] == 0xFE && input[1] == 0xFF) {
d2ed82
         confidence = 100;
d2ed82
     }
d2ed82
@@ -58,6 +59,7 @@
d2ed82
     const uint8_t *input = textIn->fRawInput;
d2ed82
     int32_t confidence = 0;
d2ed82
+    int32_t length = textIn->fRawLength;
d2ed82
 
d2ed82
-    if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
d2ed82
+    if (length >= 4 && input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
d2ed82
         confidence = 100;
d2ed82
     }
d2ed82
@@ -82,5 +84,5 @@
d2ed82
     int32_t confidence = 0;
d2ed82
 
d2ed82
-    if (getChar(input, 0) == 0x0000FEFFUL) {
d2ed82
+    if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) {
d2ed82
         hasBOM = TRUE;
d2ed82
     }