https://github.com/satyajanga created 
https://github.com/llvm/llvm-project/pull/188363

Use next_sect_sp instead of sect_sp when getting the byte size inside the 
section-walking loop. Using the original sect_sp meant sect_size never changed 
between iterations, producing an incorrect SizeOfImage and risking an infinite 
loop when sections have different sizes.

>From 538b756ad07be54aeb0c774e1ed19384e338b036 Mon Sep 17 00:00:00 2001
From: satya janga <[email protected]>
Date: Tue, 24 Mar 2026 14:56:03 -0700
Subject: [PATCH] [lldb][Minidump] Fix wrong variable in getModuleFileSize loop

Use next_sect_sp instead of sect_sp when getting the byte size inside
the section-walking loop. Using the original sect_sp meant sect_size
never changed between iterations, producing an incorrect SizeOfImage
and risking an infinite loop when sections have different sizes.
---
 lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index 8fca95512ace3..876eea28a8923 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -279,7 +279,7 @@ llvm::Expected<uint64_t> getModuleFileSize(Target &target,
   lldb::SectionSP next_sect_sp = sect_so_addr.GetSection();
   while (next_sect_sp &&
          next_sect_sp->GetLoadBaseAddress(&target) == next_sect_addr) {
-    sect_size = sect_sp->GetByteSize();
+    sect_size = next_sect_sp->GetByteSize();
     SizeOfImage += sect_size;
     next_sect_addr += sect_size;
     target.ResolveLoadAddress(next_sect_addr, sect_so_addr);

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to