fix handling broken unicode character hang
authorJeffrey Crowell <crowell@bu.edu>
Mon, 8 Dec 2014 15:46:21 +0000 (10:46 -0500)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 9 Jun 2015 11:43:23 +0000 (20:43 +0900)
fix from pagespeed change https://code.google.com/p/modpagespeed/source/detail?r=4389

cpp/src/phonenumbers/utf/unilib.cc

index 918134e..e890f97 100644 (file)
@@ -53,8 +53,8 @@ int SpanInterchangeValid(const char* begin, int byte_length) {
     int bytes_consumed = charntorune(&rune, p, end - p);
     // 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
-    // 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)) {
       break;  // Found
     }