diff mbox

[FFmpeg-devel,2/2] avcodec/utils: Enforce minimum width also for VP5/6

Message ID 20180412011246.11196-2-michael@niedermayer.cc
State Accepted
Commit 544324827e0131e43af1a54fb790a48a25fd7ba4
Headers show

Commit Message

Michael Niedermayer April 12, 2018, 1:12 a.m. UTC
Fixes: out of array access
Fixes: poc_0411

Found-by: GwanYeong Kim <gy741.kim@gmail.com>
Tested-by: GwanYeong Kim <gy741.kim@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer April 13, 2018, 8:12 p.m. UTC | #1
On Thu, Apr 12, 2018 at 03:12:46AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: poc_0411
> 
> Found-by: GwanYeong Kim <gy741.kim@gmail.com>
> Tested-by: GwanYeong Kim <gy741.kim@gmail.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/utils.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8c7d056da6..59d41ccbb6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -312,7 +312,10 @@  void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
 
     *width  = FFALIGN(*width, w_align);
     *height = FFALIGN(*height, h_align);
-    if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) {
+    if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
+        s->codec_id == AV_CODEC_ID_VP5  || s->codec_id == AV_CODEC_ID_VP6 ||
+        s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
+    ) {
         // some of the optimized chroma MC reads one line too much
         // which is also done in mpeg decoders with lowres > 0
         *height += 2;