| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 Index: source/common/uloc.c | 
|  | 2 =================================================================== | 
|  | 3 --- source/common/uloc.c        (revision 113138) | 
|  | 4 +++ source/common/uloc.c        (working copy) | 
|  | 5 @@ -1797,7 +1797,7 @@ | 
|  | 6                  int32_t variantLen = _deleteVariant(variant, uprv_min(variantSi
    ze, (nameCapacity-len)), variantToCompare, n); | 
|  | 7                  len -= variantLen; | 
|  | 8                  if (variantLen > 0) { | 
|  | 9 -                    if (name[len-1] == '_') { /* delete trailing '_' */ | 
|  | 10 +                    if (len > 0 && name[len-1] == '_') { /* delete trailing '_'
     */ | 
|  | 11                          --len; | 
|  | 12                      } | 
|  | 13                      addKeyword = VARIANT_MAP[j].keyword; | 
|  | 14 @@ -1805,7 +1805,7 @@ | 
|  | 15                      break; | 
|  | 16                  } | 
|  | 17              } | 
|  | 18 -            if (name[len-1] == '_') { /* delete trailing '_' */ | 
|  | 19 +            if (len > 0 && len <= nameCapacity && name[len-1] == '_') { /* dele
    te trailing '_' */ | 
|  | 20                  --len; | 
|  | 21              } | 
|  | 22          } | 
| OLD | NEW | 
|---|