================
@@ -2240,14 +2242,28 @@ Error 
MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
     break;
   }
   case bitc::METADATA_LABEL: {
-    if (Record.size() != 5)
+    if (Record.size() < 5 || Record.size() > 7)
       return error("Invalid record");
 
     IsDistinct = Record[0] & 1;
+    uint64_t Line = Record[4];
+    uint64_t Column = Record.size() > 5 ? Record[5] : 0;
+    bool IsArtificial = Record[0] & 2;
+    std::optional<unsigned> CoroSuspendIdx;
+    if (Record.size() > 6) {
+      unsigned RawSuspendIdx = Record[6];
+      if (RawSuspendIdx != std::numeric_limits<unsigned>::max()) {
+        if (RawSuspendIdx > (uint64_t)std::numeric_limits<unsigned>::max())
+          return error("CoroSuspendIdx value is too large");
----------------
vogelsgesang wrote:

indeed, RawSuspendIdx should have been uint64_t, and I should have checked for 
numeric_limits<uint64_t>::max here. Fixed. Thanks for catching this! :)

https://github.com/llvm/llvm-project/pull/141937
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to