[PATCH] D33892: Align definition of DW_OP_plus with DWARF spec [1/3]

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 15:40:29 PDT 2017


aprantl added inline comments.


================
Comment at: lib/Bitcode/Reader/MetadataLoader.cpp:586
+        case dwarf::DW_OP_plus:
+          Buffer.append({ dwarf::DW_OP_plus_uconst, SubExpr[1] });
+          break;
----------------
This will crash if the expression is malformed and ends after the DW_OP_plus.
It would be better to just push a DW_OP_plus_uconst to the buffer and then fall through.


================
Comment at: lib/Bitcode/Reader/MetadataLoader.cpp:589
+        default:
+          Buffer.append(SubExpr.begin(), SubExpr.begin() + HistoricSize);
+          break;
----------------
This will crash if the expression is malformed and ends after the operator.
Can you make sure not copy more elements than are in SubExpr here?


https://reviews.llvm.org/D33892





More information about the llvm-commits mailing list