diff mbox series

[FFmpeg-devel,13/16] lavfi/drawutils: ensure we can't overflow a component

Message ID 20211224030904.1196-14-rcombs@rcombs.me
State Accepted
Commit f320722eb5e3af84860063827636369115094ab5
Headers show
Series [FFmpeg-devel,01/16] swscale/output: template-ize yuv2nv12cX 10-bit and 16-bit cases | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

rcombs Dec. 24, 2021, 3:09 a.m. UTC
---
 libavfilter/drawutils.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index 99c124822d..bcdb669bd3 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -112,6 +112,8 @@  int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
         if (depthb && (depthb != db))
             return AVERROR(ENOSYS);
         depthb = db;
+        if (db * (c->offset + 1) > 16)
+            return AVERROR(ENOSYS);
         /* strange interleaving */
         if (pixelstep[c->plane] != 0 &&
             pixelstep[c->plane] != c->step)