summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-09-25 17:18:32 +0200
committerPaul B Mahol <onemda@gmail.com>2019-09-29 21:05:35 +0200
commitf1e17eb446577180ee9976730aacb46563766518 (patch)
tree827b06c63750067c4aaedb27f4685365e905ed7f
parent4a51075f4db17ce5a6fcad7548bb5cf60511d3f0 (diff)
downloadffmpeg-streaming-f1e17eb446577180ee9976730aacb46563766518.zip
ffmpeg-streaming-f1e17eb446577180ee9976730aacb46563766518.tar.gz
avcodec/qtrleenc: fix undefined behaviour
Fixes #7991.
-rw-r--r--libavcodec/qtrleenc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index cdd864b..6669c13 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -259,9 +259,10 @@ static void qtrle_encode_line(QtrleEncContext *s, const AVFrame *p, int line, ui
/* These bulk costs increase every iteration */
lowest_bulk_cost += s->pixel_size;
sec_lowest_bulk_cost += s->pixel_size;
-
- this_line -= s->pixel_size;
- prev_line -= s->pixel_size;
+ if (this_line >= p->data[0] + s->pixel_size)
+ this_line -= s->pixel_size;
+ if (prev_line >= s->previous_frame->data[0] + s->pixel_size)
+ prev_line -= s->pixel_size;
}
/* Good! Now we have the best sequence for this line, let's output it. */
OpenPOWER on IntegriCloud