Browse Source

Merge pull request #568 from crowell/patch-1

fix handling broken unicode character hang
pull/587/merge
David Yonge-Mallo 11 years ago
parent
commit
133306822c
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      cpp/src/phonenumbers/utf/unilib.cc

+ 2
- 2
cpp/src/phonenumbers/utf/unilib.cc View File

@ -53,8 +53,8 @@ int SpanInterchangeValid(const char* begin, int byte_length) {
int bytes_consumed = charntorune(&rune, p, end - p); int bytes_consumed = charntorune(&rune, p, end - p);
// We want to accept Runeerror == U+FFFD as a valid char, but it is used // We want to accept Runeerror == U+FFFD as a valid char, but it is used
// by chartorune to indicate error. Luckily, the real codepoint is size 3 // by chartorune to indicate error. Luckily, the real codepoint is size 3
// while errors return bytes_consumed == 1.
if ((rune == Runeerror && bytes_consumed == 1) ||
// while errors return bytes_consumed <= 1.
if ((rune == Runeerror && bytes_consumed <= 1) ||
!IsInterchangeValidCodepoint(rune)) { !IsInterchangeValidCodepoint(rune)) {
break; // Found break; // Found
} }


Loading…
Cancel
Save