media-playback: Fix possible crash on startup#12094
Conversation
Frame width/height check crash if the frame is not given. We can reorder width/height check after other precondition checks.
|
It seems that on load/play (or end?) of playing an audio file, An audio file will end up in the early return at Line 400: obs-studio/shared/media-playback/media-playback/media.c Lines 391 to 401 in 0fc69fb Thus, moving this frame width/height checks after that resolves that issue, and avoids adding a nullptr check for |
Lain-B
left a comment
There was a problem hiding this comment.
Either way is fine in my opinion. This is probably fine too.
|
For additional clarification, the check just needs to be after the: } else if (!d->frame_ready) {check. That will filter out any invalid pointer usage. |
Yeah, I'd figured out as much while testing this PR. We could move the check later to just before we assign width and height, but this is fine. |
Description
Newly added frame width/height check crash if the frame is not given.
We can move the width/height check after other precondition checks.
Motivation and Context
I tested the master branch on my machine, and encountered the following.
How Has This Been Tested?
My local windows 11.
Types of changes
Checklist: