From 2426f95e0fc232b01228457e5116b592c56b1f7f Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 24 May 2017 14:40:25 +0200 Subject: vd_lavc: check for missing device_ctx ref It's not really guaranteed that other components always set this (e.g. on subtle errors), so check it explicitly. Although I'm not aware of a failing case. --- video/decode/vd_lavc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'video/decode') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 8febf93325..2e7d84e55b 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -750,6 +750,11 @@ int hwdec_setup_hw_frames_ctx(struct lavc_ctx *ctx, AVBufferRef *device_ctx, int h = ctx->avctx->coded_height; int av_hw_format = imgfmt2pixfmt(ctx->hwdec_fmt); + if (!device_ctx) { + MP_ERR(ctx, "Missing device context.\n"); + return -1; + } + if (ctx->cached_hw_frames_ctx) { AVHWFramesContext *fctx = (void *)ctx->cached_hw_frames_ctx->data; if (fctx->width != w || fctx->height != h || -- cgit v1.2.3