[llvm] [pdb] Provide a better error message when overflowing the public/global symbol record stream (PR #140884)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 11:27:28 PDT 2025


================
@@ -319,7 +320,14 @@ Error GSIStreamBuilder::finalizeMsfLayout() {
     return Idx.takeError();
   PublicsStreamIndex = *Idx;
 
-  uint32_t RecordBytes = PSH->RecordByteSize + GSH->RecordByteSize;
+  uint64_t RecordBytes = PSH->RecordByteSize + GSH->RecordByteSize;
+  if (RecordBytes > UINT32_MAX)
+    return make_error<StringError>(
+        formatv("the public ({0} bytes) and global ({1} bytes) "
+                "symbols are too large to fit in a PDB file; ",
+                "the maximum total is 4294967295 bytes.
----------------
rnk wrote:

nit: maybe pass UINT32_MAX as a parameter to the formatter so we don't have to hardcode the decimal value.

https://github.com/llvm/llvm-project/pull/140884


More information about the llvm-commits mailing list