fix plaud _parseAudioChunk RangeError on truncated BLE packets#7998
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
kodjima33
approved these changes
Jun 18, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Mobile crash fix (Crashlytics): bounds-guard before sublist prevents RangeError on truncated Plaud BLE packets; mirrors existing end-marker guard. CI green.
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.
Crash
PlaudDeviceConnection._parseAudioChunk—RangeError (end): Invalid value: Not in inclusive range 9..189: 255Crashlytics: https://console.firebase.google.com/u/0/project/based-hardware/crashlytics/app/ios:com.friend-app-with-wearable.ios12/issues/89db02e25fcf378409caf8a02d4d59ca?time=7d&types=crash&sessionEventKey=5daa07a501fd4234b65d76937d9783ca_2230583383207987879
Cause
_parseAudioChunkreads byte 8 of the BLE notification payload as the audio data length, then callspayload.sublist(9, 9 + length)without checking that the slice fits within the buffer. When a truncated or malformed packet arrives, the length byte can describe more bytes than are actually present — in this case a length of 246 on a 189-byte payload gives an end index of 255, which is out of range.Fix
Added a single bounds check before the
sublistcall. If9 + length > payload.length, the packet is silently discarded (returnsnull) so the app continues normally rather than crashing.🤖 Generated with Claude Code