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

Sourabh Singh Tomar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 11:50:44 PDT 2020


SouraVX marked 2 inline comments as done.
SouraVX 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);
----------------
aprantl wrote:
> 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.
Thanks! for the suggestion. Code seems more robust and consistent now.


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

https://reviews.llvm.org/D79484





More information about the llvm-commits mailing list