[PATCH] D79484: [DebugInfo] Fortran module DebugInfo support in LLVM

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 10:45:33 PDT 2020


aprantl added inline comments.


================
Comment at: llvm/lib/Bitcode/Reader/MetadataLoader.cpp:1431
+                         Record.size() == 6 ? nullptr : getMDString(Record[6]),
+                         Record.size() == 6 ? 0 : Record[7])),
         NextMetadataNo);
----------------
You could still attack the loader with malformed input here:

`if (Record.size() < 5 || Record.size() > 8)`

means we accept a size of 6, 7, or 8. That means that

`                         Record.size() == 6 ? 0 : Record[7])),`

will access `Record[7]` if the size is 7.

I would use `Record.size() <= 6 ? nullptr : ...` and `Record.size() <= 7 ? 0 : ...`, respectively.


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

https://reviews.llvm.org/D79484





More information about the llvm-commits mailing list