[PATCH] D46274: [Support] Harden JSON against invalid UTF-8.

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 2 07:06:53 PDT 2018


sammccall added a comment.

In https://reviews.llvm.org/D46274#1083161, @benhamilton wrote:

> Is it super tricky to at least extract the UTF-8 validating and sanitizing functions into their own header and source files within the `Support` library, if not a separate library?


It turns out `ConvertUTF` already provides a nice/efficient `isLegalUTF8String` that I somehow missed before.
Given that, rewriting `fixUTF8` to use existing facilities is a little clunky but doable, and that shouldn't be hot.

So this is now a lot simpler, sorry for any wasted time :-/
Now I think the "unicode library" point is moot?


Repository:
  rL LLVM

https://reviews.llvm.org/D46274





More information about the llvm-commits mailing list