[PATCH] D76543: [llvm-dwp] Fix a possible out of bound access.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 01:35:28 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:220
+static bool isSupportedSectionKind(DWARFSectionKind Kind) {
+  return Kind >= DW_SECT_INFO && Kind <= DW_SECT_MACRO;
+}
----------------
You've got test cases for `Kind < DW_SEC_INFO`, but you probably also need cases for `Kind > DW_SECT_MACRO`.


================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:250-252
       auto &C = Entry.Contributions[Kind - DW_SECT_INFO];
       C.Offset += I->Offset;
       C.Length = I->Length;
----------------
I've not really looked around this code, so this might not make sense, but is it also worth checking that we don't emit data for these sections?


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

https://reviews.llvm.org/D76543





More information about the llvm-commits mailing list