Commit a11b3ce
committed
Fix use-after-free crash risk in screenshot haptic feedback
Found by an automated audit pass. UIImageWriteToSavedPhotosAlbum was
passed feedback via a plain __bridge cast, which doesn't transfer
ownership -- the local UINotificationFeedbackGenerator had nothing
else retaining it, so ARC could deallocate it before the async save
actually completed. screenshot:didFinishSavingWithError:contextInfo:
would then read a dangling pointer out of contextInfo on every real
screenshot. Switched to __bridge_retained on the write side and
__bridge_transfer on the completion side so ownership is actually
held across the async gap and released exactly once.1 parent 9d225fa commit a11b3ce
1 file changed
Lines changed: 7 additions & 2 deletions
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
431 | 436 | | |
432 | 437 | | |
433 | 438 | | |
434 | 439 | | |
435 | | - | |
| 440 | + | |
436 | 441 | | |
437 | 442 | | |
438 | 443 | | |
| |||
0 commit comments