summaryrefslogtreecommitdiff
path: root/icu/icu4c.10318.CVE-2013-2924_changeset_34076_icu-49.patch
blob: 360a96ca61f5278ee5743b50010854438927c3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff -ru orig.icu/source/i18n/csrucode.cpp icu/source/i18n/csrucode.cpp
--- misc/build/orig.icu/source/i18n/csrucode.cpp	2012-04-05 22:45:54.000000000 +0200
+++ misc/build/icu/source/i18n/csrucode.cpp	2013-10-09 18:56:06.521791271 +0200
@@ -1,6 +1,6 @@
 /*
  **********************************************************************
- *   Copyright (C) 2005-2006, International Business Machines
+ *   Copyright (C) 2005-2013, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  **********************************************************************
  */
@@ -31,8 +31,9 @@
 int32_t CharsetRecog_UTF_16_BE::match(InputText* textIn)
 {
     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;
     }
 
@@ -53,8 +54,9 @@
 int32_t CharsetRecog_UTF_16_LE::match(InputText* textIn)
 {
     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;
     }
 
@@ -76,7 +78,7 @@
     bool hasBOM = FALSE;
     int32_t confidence = 0;
 
-    if (getChar(input, 0) == 0x0000FEFFUL) {
+    if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) {
         hasBOM = TRUE;
     }
 
Only in icu/source/i18n: csrucode.cpp.orig