Skip to content

fix(apple-crash-report): Make code more defensive#110617

Merged
tobias-wilfert merged 6 commits intomasterfrom
tobias-wilfert/fix/apple-crash-reporter
Mar 16, 2026
Merged

fix(apple-crash-report): Make code more defensive#110617
tobias-wilfert merged 6 commits intomasterfrom
tobias-wilfert/fix/apple-crash-reporter

Conversation

@tobias-wilfert
Copy link
Copy Markdown
Member

@tobias-wilfert tobias-wilfert commented Mar 13, 2026

@tobias-wilfert tobias-wilfert self-assigned this Mar 13, 2026
@tobias-wilfert tobias-wilfert requested a review from a team as a code owner March 13, 2026 11:39
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 13, 2026
@linear-code
Copy link
Copy Markdown

linear-code bot commented Mar 13, 2026

hex(image_addr),
hex(image_addr + debug_image["image_size"] - 1),
# Default to 1 so the end address isn't before the start when image_size is missing or None
hex(image_addr + (debug_image.get("image_size") or 1) - 1),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea where this string is used, but is it still correct when we fall back to 1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used in a niche area of the product (issue with a replay of me triggering it).

@tobias-wilfert
Copy link
Copy Markdown
Member Author

As discussed offline changed it now to also use the NATIVE_UNKNOWN_STRING for the end address.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Double angle brackets in debug_id unknown fallback output
    • Changed debug_id fallback from NATIVE_UNKNOWN_STRING to 'unknown' string since format string already provides angle bracket wrapping, preventing double brackets.

Create PR

Or push these changes by commenting:

@cursor push 48583836ae
Preview (48583836ae)
diff --git a/src/sentry/lang/native/applecrashreport.py b/src/sentry/lang/native/applecrashreport.py
--- a/src/sentry/lang/native/applecrashreport.py
+++ b/src/sentry/lang/native/applecrashreport.py
@@ -306,6 +306,6 @@
             hex(image_addr + image_size - 1) if image_size else NATIVE_UNKNOWN_STRING,
             image_name(debug_image.get("code_file") or NATIVE_UNKNOWN_STRING),
             get_path(self.context, "device", "arch") or NATIVE_UNKNOWN_STRING,
-            (debug_image.get("debug_id") or "").replace("-", "").lower() or NATIVE_UNKNOWN_STRING,
+            (debug_image.get("debug_id") or "").replace("-", "").lower() or "unknown",
             debug_image.get("code_file") or NATIVE_UNKNOWN_STRING,
         )

diff --git a/tests/sentry/lang/native/test_applecrashreport.py b/tests/sentry/lang/native/test_applecrashreport.py
--- a/tests/sentry/lang/native/test_applecrashreport.py
+++ b/tests/sentry/lang/native/test_applecrashreport.py
@@ -551,7 +551,7 @@
     )
     assert (
         binary_image
-        == "0xd69a000 - 0xd712fff SentrySwift x86  <<unknown>> /Users/haza/Library/Developer/CoreSimulator/Devices/DDB32F4C-97CF-4E2B-BD10-EB940553F223/data/Containers/Bundle/Application/8F8140DF-B25B-4088-B5FB-57F474A49CD6/SwiftExample.app/Frameworks/SentrySwift.framework/SentrySwift"
+        == "0xd69a000 - 0xd712fff SentrySwift x86  <unknown> /Users/haza/Library/Developer/CoreSimulator/Devices/DDB32F4C-97CF-4E2B-BD10-EB940553F223/data/Containers/Bundle/Application/8F8140DF-B25B-4088-B5FB-57F474A49CD6/SwiftExample.app/Frameworks/SentrySwift.framework/SentrySwift"
     )

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@tobias-wilfert tobias-wilfert merged commit 4a14766 into master Mar 16, 2026
57 checks passed
@tobias-wilfert tobias-wilfert deleted the tobias-wilfert/fix/apple-crash-reporter branch March 16, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants