fix: Fix JSON encoding of infinite numeric values in crash reports#7802
Merged
fix: Fix JSON encoding of infinite numeric values in crash reports#7802
Conversation
Ports numeric encoding guards from upstream KSCrash (kstenerud/KSCrash#526 (kstenerud/KSCrash#526)): - Encode ±infinity as 1e999/-1e999 instead of the invalid JSON literal inf - Validate snprintf return before emitting data (format before beginElement so errors can't corrupt the JSON stream) Also validates battery level in SentrySystemEventBreadcrumbs — rejects non-finite and out of-range values before they reach the crash-scope JSON encoder. Relates to #4580
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧Deps
🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7802 +/- ##
=============================================
+ Coverage 85.452% 85.470% +0.018%
=============================================
Files 487 487
Lines 29311 29327 +16
Branches 12671 12680 +9
=============================================
+ Hits 25047 25066 +19
+ Misses 4213 4211 -2
+ Partials 51 50 -1
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
itaybre
reviewed
Apr 15, 2026
philprime
reviewed
Apr 20, 2026
philprime
approved these changes
Apr 27, 2026
…om upstream and add comments
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bab8d5e | 1225.12 ms | 1258.35 ms | 33.23 ms |
| e8cc4e7 | 1204.21 ms | 1239.22 ms | 35.01 ms |
| 164f67b | 1218.07 ms | 1245.28 ms | 27.21 ms |
| 60ea6f8 | 1209.42 ms | 1246.62 ms | 37.21 ms |
| 3a42337 | 1221.24 ms | 1249.06 ms | 27.82 ms |
| 18c94be | 1218.26 ms | 1258.80 ms | 40.54 ms |
| b206854 | 1228.68 ms | 1250.76 ms | 22.08 ms |
| 21cd5ba | 1218.68 ms | 1255.54 ms | 36.86 ms |
| 2aca3cc | 1229.83 ms | 1263.59 ms | 33.76 ms |
| 4b41eee | 1209.96 ms | 1243.12 ms | 33.16 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bab8d5e | 24.14 KiB | 1.13 MiB | 1.11 MiB |
| e8cc4e7 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 164f67b | 24.14 KiB | 1.12 MiB | 1.09 MiB |
| 60ea6f8 | 24.14 KiB | 1.12 MiB | 1.10 MiB |
| 3a42337 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 18c94be | 24.14 KiB | 1.10 MiB | 1.08 MiB |
| b206854 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| 21cd5ba | 24.14 KiB | 1.04 MiB | 1.02 MiB |
| 2aca3cc | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 4b41eee | 24.14 KiB | 1.09 MiB | 1.07 MiB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Ports numeric encoding guards from upstream KSCrash (kstenerud/KSCrash#526 (kstenerud/KSCrash#526)):
💡 Motivation and Context
Relates to #4580
💚 How did you test it?
Unit tests.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.