[FFmpeg-cvslog] avformat/mov: Don't allow negative sample sizes.

Dale Curtis git at videolan.org
Sun Jul 5 20:50:20 EEST 2020


ffmpeg | branch: release/2.8 | Dale Curtis <dalecurtis at chromium.org> | Thu May 14 15:31:55 2020 -0700| [832ae51f9b4ce1003c2e817900b0332d1df457f7] | committer: Michael Niedermayer

avformat/mov: Don't allow negative sample sizes.

Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2d8d554f15a7a27cfeca81467cc9341a86f784e2)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index cc56c8792a..10b0c1d7e7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2417,6 +2417,10 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     for (i = 0; i < entries && !pb->eof_reached; i++) {
         sc->sample_sizes[i] = get_bits_long(&gb, field_size);
+        if (sc->sample_sizes[i] < 0) {
+            av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", sc->sample_sizes[i]);
+            return AVERROR_INVALIDDATA;
+        }
         sc->data_size += sc->sample_sizes[i];
     }
 



More information about the ffmpeg-cvslog mailing list