Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defensive copying in Android legacy, deprecated BluetoothGattCallback functions #635

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

cedrickcooke
Copy link
Contributor

The docs now explicitly call out that these deprecated callbacks are not memory safe.

Screenshot 2024-02-20 at 1 55 09 PM

Since we still have to use them to support older Android versions, a defensive copy should either:

  • guarantee memory safety (if Android doesn't modify the characteristic mid-callback)
  • narrow the danger range (if Android can modify the characteristic mid-callback)

Unfortunately I'm not sure which behavior Android has, but I figure this is a win either way -- just a question of total win or partial.

@cedrickcooke cedrickcooke added android patch Changes that should bump the PATCH version number labels Feb 20, 2024
@cedrickcooke cedrickcooke requested review from twyatt and a team as code owners February 20, 2024 21:57
@twyatt twyatt enabled auto-merge (squash) February 22, 2024 20:51
@twyatt twyatt merged commit 75b058b into main Feb 22, 2024
2 checks passed
@twyatt twyatt deleted the cedrickc/legacy-android-defensive-copying branch February 22, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android patch Changes that should bump the PATCH version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants