[FFmpeg-devel] [PATCH 1/2] avcodec/dxva2: d3d11va: don't try to get surface description for nullptr

Anton Fedchin afedchin at weezlabs.com
Sat Jan 12 17:31:35 EET 2019


From: Anton Fedchin <afedchin at ruswizards.com>

after 153b36f there is a possibility to crash when trying to get index of
a surface which points to nirvana. it may occurs when a stream starts with
non i-frame.
---
 libavcodec/dxva2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 32416112bf..e0919d0b1c 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -771,7 +771,7 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
 #if CONFIG_D3D11VA
     if (avctx->pix_fmt == AV_PIX_FMT_D3D11)
         return (intptr_t)frame->data[1];
-    if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+    if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && surface) {
         D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
         ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, &viewDesc);
         return viewDesc.Texture2D.ArraySlice;
-- 
2.17.1.windows.2



More information about the ffmpeg-devel mailing list