[vlc-commits] dxva2: check number of surfaces to allocate is not larger than the upper bound
Felix Abecassis
git at videolan.org
Tue Mar 4 21:36:28 CET 2014
vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Tue Mar 4 15:22:01 2014 +0100| [fe573d25f0c5c640e822671e561013ae8f3a069e] | committer: Rémi Denis-Courmont
dxva2: check number of surfaces to allocate is not larger than the upper bound
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe573d25f0c5c640e822671e561013ae8f3a069e
---
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,
More information about the vlc-commits
mailing list