[PATCH] D61608: YAML parser robustness improvements

Michael Spencer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 14:29:02 PDT 2019


Bigcheese added inline comments.


================
Comment at: lib/Support/YAMLParser.cpp:937
+  if (Expected >= 0x80) {
+    setError("Not dealing with this yet");
+    return false;
----------------
This error and the one below should be something closer to: "Unable to parse non-ascii here".


================
Comment at: lib/Support/YAMLParser.cpp:1235-1238
+    if (i == e) {
+      setError("SimpleKey not in token queue!");
+      return false;
+    }
----------------
I realize you changed this so fuzzing works, but this isn't how this case should be handled.  setError should be for user error, this is a programming error as the situation should never happen.


================
Comment at: lib/Support/YAMLParser.cpp:1949
+        T.Range = StringRef(UnquotedValue.begin(), 1);
+        setError("Unrecognized escape code!", T);
+        return "";
----------------
We shouldn't use ! in error messages.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61608/new/

https://reviews.llvm.org/D61608





More information about the llvm-commits mailing list