[PATCH] D139315: [NFC][LLVM-MT] Fix buffer-overflow when comparing buffers
Alex Brachet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 6 13:43:48 PST 2022
abrachet added inline comments.
================
Comment at: llvm/tools/llvm-mt/llvm-mt.cpp:153-157
+ bool SameSize =
+ OutputBuffer->getBufferSize() == FileBuffer->getBufferSize();
+ Same = SameSize && std::equal(OutputBuffer->getBufferStart(),
+ OutputBuffer->getBufferEnd(),
+ FileBuffer->getBufferStart());
----------------
jmmartinez wrote:
> abrachet wrote:
> > That should work too. WDYT?
> I didn't know about that overload. I'll change it use your version.
Ah, sorry I didn't mean to keep SameSize in my suggested change. Just this should be sufficient
```
Same = std::equal(OutputBuffer->getBufferStart(),
OutputBuffer->getBufferEnd(),
FileBuffer->getBufferStart());
FileBuffer->getBufferStart(),
FileBuffer->getBufferEnd());
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139315/new/
https://reviews.llvm.org/D139315
More information about the llvm-commits
mailing list