From e9588bb46f6aba2927e53a924a5c3ed01b5ccfaf Mon Sep 17 00:00:00 2001 From: Ali Ghaznavi Date: Fri, 18 Sep 2026 14:45:42 -0400 Subject: [PATCH] Adds safety checking and fall back for getting lib path in symbol resolver Fix merge conflich in Crashlytics/CHANGELOG.md --- Crashlytics/CHANGELOG.md | 1 + .../Crashlytics/Models/FIRCLSSymbolResolver.m | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Crashlytics/CHANGELOG.md b/Crashlytics/CHANGELOG.md index c3471a42117..c221e3de83c 100644 --- a/Crashlytics/CHANGELOG.md +++ b/Crashlytics/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - [fixed] Safely validate memory reads when executing `DW_OP_deref_size` operations during DWARF stack unwinding (#16550). +- [fixed] Fixed an issue casuing a crash while symbolicating stack frames if the binary image path is null. (#16622) # 12.18.0 - [removed] Removes unused integration with the now deprecated ObjC MetricKit API. diff --git a/Crashlytics/Crashlytics/Models/FIRCLSSymbolResolver.m b/Crashlytics/Crashlytics/Models/FIRCLSSymbolResolver.m index 8ce74da5690..970768b516e 100644 --- a/Crashlytics/Crashlytics/Models/FIRCLSSymbolResolver.m +++ b/Crashlytics/Crashlytics/Models/FIRCLSSymbolResolver.m @@ -168,7 +168,20 @@ - (BOOL)updateStackFrame:(FIRStackFrame*)frame { [frame setOffset:addr - (uintptr_t)dlInfo.dli_saddr]; } - [frame setLibrary:[[binaryImage objectForKey:@"path"] lastPathComponent]]; + NSString* library = nil; + id rawPath = [binaryImage objectForKey:@"path"]; + + if ([rawPath isKindOfClass:[NSString class]] && [(NSString*)rawPath length] > 0) { + library = [(NSString*)rawPath lastPathComponent]; + } else if (dlInfo.dli_fname && strlen(dlInfo.dli_fname) > 0) { + library = [[NSString stringWithUTF8String:dlInfo.dli_fname] lastPathComponent]; + } + + if (library) { + [frame setLibrary:library]; + } else { + FIRCLSSDKLog("Could not find library path\n"); + } return YES; }