[Lldb-commits] [PATCH] D154907: [LLDB] Fix buffer overflow problem in DWARFExpression::Evaluate (2nd attempt)

David Blaikie via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 19 15:25:43 PDT 2023


dblaikie added inline comments.


================
Comment at: lldb/source/Expression/DWARFExpression.cpp:1082-1089
         void *src = (void *)stack.back().GetScalar().ULongLong();
         intptr_t ptr;
         ::memcpy(&ptr, src, sizeof(void *));
         // I can't decide whether the size operand should apply to the bytes in
         // their
         // lldb-host endianness or the target endianness.. I doubt this'll ever
         // come up but I'll opt for assuming big endian regardless.
----------------
dblaikie wrote:
> Just as an aside - isn't this code doing an illegal load widening? If the pointer pointed to the end of a page or something, and asked for only one byte - reading extra bytes would be bad (similarly would cause a segfault/UB/etc), right?
> 
> (& I'm not sure I understand the comment about endianness - the operation reads that many bytes from the given address)
oh, guess I also mentioned this here: https://reviews.llvm.org/D153840#inline-1494202


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154907



More information about the lldb-commits mailing list