https://github.com/gmondada created 
https://github.com/llvm/llvm-project/pull/173966

Fix for the following problem: 

Command qModuleInfo (GDB server protocol) can be used to request metadata of 
shared libraries stored in a ZIP archive on the target. This is typically used 
for retrieving SO files bundled in a APK file on Android.

Requesting the last entry in the ZIP file often fails because of a bug in the 
entry search mechanism.

NOTE: This is part on an effort to get lldb working for debugging Swift on 
Android: https://github.com/swiftlang/llvm-project/issues/10831

>From 72fe6f3e28d7c67cde32ad7efbcc5fae45e78cbe Mon Sep 17 00:00:00 2001
From: Gabriele Mondada <[email protected]>
Date: Mon, 29 Dec 2025 23:28:34 +0100
Subject: [PATCH] [lldb-server] Fix zip file lookup ignoring last entry in the
 zip file

Command qModuleInfo can be used to request metadata of shared libraries stored 
in a ZIP archive on the target (typically used for APK on Android). Requesting 
the last entry in the ZIP file often fails because of a bug in the entry search 
mechanism.
---
 lldb/source/Utility/ZipFile.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Utility/ZipFile.cpp b/lldb/source/Utility/ZipFile.cpp
index b8ed956cbfcb2..e47c690e65b0d 100644
--- a/lldb/source/Utility/ZipFile.cpp
+++ b/lldb/source/Utility/ZipFile.cpp
@@ -144,7 +144,7 @@ bool FindFile(lldb::DataBufferSP zip_data, const EocdRecord 
*eocd,
     // Sanity check the file name values.
     auto file_name = reinterpret_cast<const char *>(cd + 1);
     size_t file_name_length = cd->file_name_length;
-    if (file_name + file_name_length >= reinterpret_cast<const char *>(eocd) ||
+    if (file_name + file_name_length > reinterpret_cast<const char *>(eocd) ||
         file_name_length == 0)
       return false;
 

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

Reply via email to