mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-4703 Fix u_errorName bounds checking.
X-SVN-Rev: 19465
This commit is contained in:
parent
27ec624563
commit
4c80e2649e
2 changed files with 5 additions and 8 deletions
|
@ -684,8 +684,8 @@ typedef enum UErrorCode {
|
|||
/*
|
||||
* the error code range 0x10200 0x102ff are reserved for Break Iterator related error
|
||||
*/
|
||||
U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */
|
||||
U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */
|
||||
U_BRK_INTERNAL_ERROR, /**< An internal error (bug) was detected. */
|
||||
U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */
|
||||
U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */
|
||||
U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */
|
||||
|
@ -704,8 +704,8 @@ typedef enum UErrorCode {
|
|||
/*
|
||||
* The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs
|
||||
*/
|
||||
U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */
|
||||
U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */
|
||||
U_REGEX_INTERNAL_ERROR, /**< An internal error (bug) was detected. */
|
||||
U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */
|
||||
U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */
|
||||
U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */
|
||||
|
@ -724,8 +724,8 @@ typedef enum UErrorCode {
|
|||
/*
|
||||
* The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes
|
||||
*/
|
||||
U_IDNA_PROHIBITED_ERROR=0x10400,
|
||||
U_IDNA_ERROR_START=0x10400,
|
||||
U_IDNA_PROHIBITED_ERROR,
|
||||
U_IDNA_UNASSIGNED_ERROR,
|
||||
U_IDNA_CHECK_BIDI_ERROR,
|
||||
U_IDNA_STD3_ASCII_RULES_ERROR,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2005, International Business Machines
|
||||
* Copyright (C) 1997-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -121,7 +121,6 @@ _uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
|
|||
|
||||
static const char * const
|
||||
_uBrkErrorName[U_BRK_ERROR_LIMIT - U_BRK_ERROR_START] = {
|
||||
"U_BRK_ERROR_START",
|
||||
"U_BRK_INTERNAL_ERROR",
|
||||
"U_BRK_HEX_DIGITS_EXPECTED",
|
||||
"U_BRK_SEMICOLON_EXPECTED",
|
||||
|
@ -140,7 +139,6 @@ _uBrkErrorName[U_BRK_ERROR_LIMIT - U_BRK_ERROR_START] = {
|
|||
|
||||
static const char * const
|
||||
_uRegexErrorName[U_REGEX_ERROR_LIMIT - U_REGEX_ERROR_START] = {
|
||||
"U_REGEX_ERROR_START",
|
||||
"U_REGEX_INTERNAL_ERROR",
|
||||
"U_REGEX_RULE_SYNTAX",
|
||||
"U_REGEX_INVALID_STATE",
|
||||
|
@ -159,7 +157,6 @@ _uRegexErrorName[U_REGEX_ERROR_LIMIT - U_REGEX_ERROR_START] = {
|
|||
|
||||
static const char * const
|
||||
_uIDNAErrorName[U_IDNA_ERROR_LIMIT - U_IDNA_ERROR_START] = {
|
||||
"U_IDNA_ERROR_START",
|
||||
"U_STRINGPREP_PROHIBITED_ERROR",
|
||||
"U_STRINGPREP_UNASSIGNED_ERROR",
|
||||
"U_STRINGPREP_CHECK_BIDI_ERROR",
|
||||
|
@ -184,7 +181,7 @@ u_errorName(UErrorCode code) {
|
|||
return _uBrkErrorName[code - U_BRK_ERROR_START];
|
||||
} else if (U_REGEX_ERROR_START <= code && code < U_REGEX_ERROR_LIMIT) {
|
||||
return _uRegexErrorName[code - U_REGEX_ERROR_START];
|
||||
} else if( U_IDNA_ERROR_START <= code && code <= U_IDNA_ERROR_LIMIT) {
|
||||
} else if(U_IDNA_ERROR_START <= code && code < U_IDNA_ERROR_LIMIT) {
|
||||
return _uIDNAErrorName[code - U_IDNA_ERROR_START];
|
||||
} else {
|
||||
return "[BOGUS UErrorCode]";
|
||||
|
|
Loading…
Add table
Reference in a new issue