1 Index: /icu/trunk/source/i18n/csrucode.cpp
2 ===================================================================
3 --- a/orig.icu/source/i18n/csrucode.cpp (revision 34075)
4 +++ b/icu/source/i18n/csrucode.cpp (revision 34076)
7 **********************************************************************
8 - * Copyright (C) 2005-2012, International Business Machines
9 + * Copyright (C) 2005-2013, International Business Machines
10 * Corporation and others. All Rights Reserved.
11 **********************************************************************
13 const uint8_t *input = textIn->fRawInput;
14 int32_t confidence = 0;
15 + int32_t length = textIn->fRawLength;
17 - if (input[0] == 0xFE && input[1] == 0xFF) {
18 + if (length >=2 && input[0] == 0xFE && input[1] == 0xFF) {
22 const uint8_t *input = textIn->fRawInput;
23 int32_t confidence = 0;
24 + int32_t length = textIn->fRawLength;
26 - if (input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
27 + if (length >= 4 && input[0] == 0xFF && input[1] == 0xFE && (input[2] != 0x00 || input[3] != 0x00)) {
31 int32_t confidence = 0;
33 - if (getChar(input, 0) == 0x0000FEFFUL) {
34 + if (limit > 0 && getChar(input, 0) == 0x0000FEFFUL) {