summaryrefslogtreecommitdiff
path: root/libavfilter/vsrc_testsrc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-12-15 15:52:48 +0100
committerPaul B Mahol <onemda@gmail.com>2016-12-15 16:03:48 +0100
commit745f4bcc2c1deaa562cce01fa52e38b0220aed31 (patch)
tree56680021538aa8261eb535b49915c2daeee05b81 /libavfilter/vsrc_testsrc.c
parentab87df9a47cd31bfcae9acd84c04705a149dfc14 (diff)
downloadffmpeg-745f4bcc2c1deaa562cce01fa52e38b0220aed31.tar.gz
avfilter/vsrc_testsrc: draw_bar: make sure width is not negative
Reported-by: Josh de Kock Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/vsrc_testsrc.c')
-rw-r--r--libavfilter/vsrc_testsrc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 08f6e07e50..422f6d8c54 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1309,8 +1309,8 @@ static void draw_bar(TestSourceContext *test, const uint8_t color[4],
x = FFMIN(x, test->w - 1);
y = FFMIN(y, test->h - 1);
- w = FFMIN(w, test->w - x);
- h = FFMIN(h, test->h - y);
+ w = FFMAX(FFMIN(w, test->w - x), 0);
+ h = FFMAX(FFMIN(h, test->h - y), 0);
av_assert0(x + w <= test->w);
av_assert0(y + h <= test->h);