[vlc-devel] [PATCH 3/4] dxva2: check number of surfaces to allocate is not larger than the upper bound
Felix Abecassis
felix.abecassis at gmail.com
Tue Mar 4 15:22:01 CET 2014
---
modules/codec/avcodec/dxva2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index a7c9ce2..c1d1a4a 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -855,14 +855,18 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va,
/* Allocates all surfaces needed for the decoder */
va->surface_width = (fmt->i_width + 15) & ~15;
va->surface_height = (fmt->i_height + 15) & ~15;
+ int surface_count;
switch (codec_id) {
case AV_CODEC_ID_H264:
- va->surface_count = 16 + 1;
+ surface_count = 16 + 1;
break;
default:
- va->surface_count = 2 + 1;
+ surface_count = 2 + 1;
break;
}
+ if (surface_count > VA_DXVA2_MAX_SURFACE_COUNT)
+ return VLC_EGENERIC;
+ va->surface_count = surface_count;
if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs,
va->surface_width,
va->surface_height,
--
1.8.3.2
More information about the vlc-devel
mailing list