From e18cf0b92a25bfef5dd99b195effaf59a34f101b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 3 Jun 2023 17:06:36 +0200 Subject: video/out/android: assert WinID value before use --- video/out/android_common.c | 1 + video/out/vo_mediacodec_embed.c | 1 + 2 files changed, 2 insertions(+) (limited to 'video/out') diff --git a/video/out/android_common.c b/video/out/android_common.c index 7efed3caee..27e7b5bb5b 100644 --- a/video/out/android_common.c +++ b/video/out/android_common.c @@ -44,6 +44,7 @@ bool vo_android_init(struct vo *vo) goto fail; } + assert(vo->opts->WinID != 0 && vo->opts->WinID != -1); jobject surface = (jobject)(intptr_t)vo->opts->WinID; ctx->native_window = ANativeWindow_fromSurface(env, surface); if (!ctx->native_window) { diff --git a/video/out/vo_mediacodec_embed.c b/video/out/vo_mediacodec_embed.c index aef7e1a23d..3a1df2fd2c 100644 --- a/video/out/vo_mediacodec_embed.c +++ b/video/out/vo_mediacodec_embed.c @@ -37,6 +37,7 @@ static AVBufferRef *create_mediacodec_device_ref(struct vo *vo) AVHWDeviceContext *ctx = (void *)device_ref->data; AVMediaCodecDeviceContext *hwctx = ctx->hwctx; + assert(vo->opts->WinID != 0 && vo->opts->WinID != -1); hwctx->surface = (void *)(intptr_t)(vo->opts->WinID); if (av_hwdevice_ctx_init(device_ref) < 0) -- cgit v1.2.3