Skip to content

Commit 3437e2b

Browse files
committed
win-dshow: Fix possible crash if frame width or height is zero
If a frame has a width or height of zero, this value will make it into libobs/media-io/video-frame.c:video_frame_init and cause linesizes or heights to be zero, which will result in a bmalloc(0) call and OBS will crash. Instead of letting the call stack get that far, check the frame width and height here at the source, log an error, and return early if the frame width or height are zero.
1 parent 90570e7 commit 3437e2b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

plugins/win-dshow/win-dshow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,12 @@ bool DShowInput::UpdateVideoConfig(obs_data_t *settings)
936936
return false;
937937
}
938938

939+
if (!videoConfig.cx || !videoConfig.cy_abs) {
940+
blog(LOG_ERROR, "%s: Frame width or height are zero (%" PRIu32 "x%" PRIu32 ")",
941+
obs_source_get_name(source), videoConfig.cx, videoConfig.cy_abs);
942+
return false;
943+
}
944+
939945
DStr formatName = GetVideoFormatName(videoConfig.internalFormat);
940946

941947
double fps = 0.0;

0 commit comments

Comments
 (0)