liburlpattern: Add missing check for U8_NEXT return to Tokenizer

The ICU macro U8_NEXT's documentation [0] indicates that it may return a
negative codepoint on failure.

This CL annotates the Tokenizer::Next() and NextAt() methods with
WARN_UNUSED_RESULT, and adds appropriate error-handling to affected call
sites.

Prior to this change, the original input (below) was parsed and
canonicalized to a string that failed the canonicalization idempotency
property check. With this change, the original input is rejected at
position 1 because 0xcd is an illegal UTF8 codepoint.

    original :
       *      *   {   }   ?   *   ?
      2a  cd  2a  7b  7d  3f  2a  3f
    canonical:
       *      *   *   ?
      2a  cd  2a  2a  3f

[0]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/icu/source/common/unicode/utf8.h;l=352;drc=f90543d272e2e2edc5b3cdf8ead0b5b3eebceef5

Bug: 1263594
Change-Id: Ib1c66cb322f0c48db2ae7e264cdfd5818975ac9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3248041
Commit-Queue: Dan McArdle <[email protected]>
Reviewed-by: Ben Kelly <[email protected]>
Cr-Commit-Position: refs/heads/main@{#935863}
diff --git a/third_party/liburlpattern/parse.h b/third_party/liburlpattern/parse.h
index add6eec..9af64518 100644
--- a/third_party/liburlpattern/parse.h
+++ b/third_party/liburlpattern/parse.h
@@ -29,10 +29,10 @@
 typedef std::function<absl::StatusOr<std::string>(absl::string_view)>
     EncodeCallback;
 
-// Parse a pattern string and return the result.  The input |pattern| must
-// consist of UTF-8 characters.  Currently only group names may actually
-// contain non-ASCII characters, however.  Unicode characters in other parts
-// of the pattern will cause an error to be returned.  A |callback| must be
+// Parse a pattern string and return the result.  The parse will fail if the
+// input |pattern| is not valid UTF-8.  Currently only group names may actually
+// contain non-ASCII characters, however.  Unicode characters in other parts of
+// the pattern will cause an error to be returned.  A |callback| must be
 // provided to validate and encode plain text parts of the pattern.  An
 // |options| value may be provided to override default behavior.
 COMPONENT_EXPORT(LIBURLPATTERN)