[PATCH] D84050: YAML: Don't assume an arbitrary StringRef is null terminated

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 15:32:02 PDT 2020


dexonsmith requested changes to this revision.
dexonsmith added a comment.
This revision now requires changes to proceed.

In D84050#2242755 <https://reviews.llvm.org/D84050#2242755>, @arsenm wrote:

> In D84050#2189370 <https://reviews.llvm.org/D84050#2189370>, @bkramer wrote:
>
>> The parser used to rely on the `\0` being present. Was that fixed?
>
> Do you know where this assumption was? I couldn't find it, but also couldn't find any commits that seemed to "fix" it. I haven't seen a sanitizer error yet

I just did a quick scan and I can't find any such assumption either. @Bigcheese, do remember what the original intent was?



================
Comment at: llvm/lib/Support/YAMLParser.cpp:776
   std::unique_ptr<MemoryBuffer> InputBufferOwner =
-      MemoryBuffer::getMemBuffer(Buffer);
+      MemoryBuffer::getMemBuffer(Buffer, false);
   SM.AddNewSourceBuffer(std::move(InputBufferOwner), SMLoc());
----------------
Please spell this `/*RequiresNullTerminator=*/false`.


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

https://reviews.llvm.org/D84050



More information about the llvm-commits mailing list