[FFmpeg-cvslog] avfilter/vsrc_testsrc: draw_bar: make sure width is not negative

Paul B Mahol git at videolan.org
Thu Dec 15 17:05:06 EET 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Dec 15 15:52:48 2016 +0100| [745f4bcc2c1deaa562cce01fa52e38b0220aed31] | committer: Paul B Mahol

avfilter/vsrc_testsrc: draw_bar: make sure width is not negative

Reported-by: Josh de Kock
Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=745f4bcc2c1deaa562cce01fa52e38b0220aed31
---

 libavfilter/vsrc_testsrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 08f6e07..422f6d8 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);



More information about the ffmpeg-cvslog mailing list