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; }