public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: Handle out of order modules for module offsets in stackdump
@ 2022-11-04 15:11 Jon TURNEY
  0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2022-11-04 15:11 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=564c88b89833d711281f7b5dd2b74b453dc66ea9

commit 564c88b89833d711281f7b5dd2b74b453dc66ea9
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Nov 1 14:01:08 2022 +0000

    Cygwin: Handle out of order modules for module offsets in stackdump
    
    Improve address to module+offset conversion, to work correctly in the
    presence of out-of-order elements in InMemoryOrderModuleList.
    
    Fixes: d59651d4

Diff:
---
 winsup/cygwin/exceptions.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 8cc454c90..c3433ab94 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -342,11 +342,13 @@ prettyprint_va (PVOID func_va)
     {
       PLDR_DATA_TABLE_ENTRY mod = CONTAINING_RECORD (x, LDR_DATA_TABLE_ENTRY,
 						     InMemoryOrderLinks);
-      if (mod->DllBase > func_va)
+      if ((func_va < mod->DllBase) ||
+	  (func_va > (PVOID)((DWORD_PTR)mod->DllBase + mod->SizeOfImage)))
 	continue;
 
       __small_sprintf (buf, "%S+0x%x", &mod->BaseDllName,
 		       (DWORD_PTR)func_va - (DWORD_PTR)mod->DllBase);
+      break;
     }
 
   return buf;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-04 15:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 15:11 [newlib-cygwin] Cygwin: Handle out of order modules for module offsets in stackdump Jon TURNEY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).