Skip to content

[camera] Add protection around DroidMediaCamera pointer in CameraListener#59

Open
peat-psuwit wants to merge 1 commit intosailfishos:masterfrom
peat-psuwit:fix-camera-uaf
Open

[camera] Add protection around DroidMediaCamera pointer in CameraListener#59
peat-psuwit wants to merge 1 commit intosailfishos:masterfrom
peat-psuwit:fix-camera-uaf

Conversation

@peat-psuwit
Copy link
Copy Markdown
Contributor

When destroying DroidMediaCamera, CameraListener held inside an ongoing
callback can outlive the destroying instance. To prevent it from
accessing DroidMediaCamera after being destroyed, one needs to remove
the reference to DroidMediaCamera inside the listener before deleting
it.

As this removal happens in a different thread then callbacks, a mutex is
required to prevent race condition. Also, just to be safe, remove the
listener from the Android Camera instance as well.

…ener

When destroying DroidMediaCamera, CameraListener held inside an ongoing
callback can outlive the destroying instance. To prevent it from
accessing DroidMediaCamera after being destroyed, one needs to remove
the reference to DroidMediaCamera inside the listener before deleting
it.

As this removal happens in a different thread then callbacks, a mutex is
required to prevent race condition. Also, just to be safe, remove the
listener from the Android Camera instance as well.
@pvuorela
Copy link
Copy Markdown

pvuorela commented Jul 6, 2021

@mlehtima or @abranson

@pvuorela pvuorela requested review from abranson and mlehtima August 12, 2021 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants