I feed custom buffers to clang, and since the buffers store an explicit length, I did not think to null-terminate them.
However, this causes clang to run out-of-bounds in certain situations in ComputeLineNumbers. Since under certain
situations ComputeLineNumbers does look at the given bounds, I figured the proper solution was to always check the
buffer for EOF. Please let me know if I missed something and this was intended.
Details
Details
- Reviewers
bkramer
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Generally, I thought clang often relies on buffers being null terminated to speed up parse times. Usually the MemoryBuffers have an option to guarantee null-terminatedness (and copy if necessary)
Comment Actions
Hmm, you're right. And I am actually constructing it in such a way that it's supposed to have it, so I wonder why it ran off the rails here. Will take another look.
Comment Actions
Oh, I see it checks for the null terminator past the end of the given memory block on construction, but if the memory after changes later this just keeps running. Well, that's quite a trap, but I guess that's what you get for not understanding the API ;).