Bug fix of a large amount memory allocation 04/316204/5 accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_x tizen accepted/tizen/unified/20240816.171426 accepted/tizen/unified/dev/20240819.095705 accepted/tizen/unified/x/20240819.023311
authorJiyong <jiyong.min@samsung.com>
Fri, 16 Aug 2024 01:04:12 +0000 (10:04 +0900)
committerJiyong <jiyong.min@samsung.com>
Fri, 16 Aug 2024 01:38:00 +0000 (10:38 +0900)
[Cause]
Allocate memory for incorrect key
[Solution]
Apply ffmpeg's patch for skipping other key
[FFmpeg Patch]
https://github.com/FFmpeg/FFmpeg/commit/8a23a145d85964950123952d897b89c2c2b1b8c5
https://github.com/FFmpeg/FFmpeg/commit/5a06d3810e41134ee9c2941cc0b371da62b539db

Change-Id: Ic1958d6530fd6f22472643f09e0d345f98430b54

libavformat/mov.c
packaging/ffmpeg.spec

index ca67f03..288dd77 100644 (file)
@@ -4813,15 +4813,17 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     for (i = 1; i <= count; ++i) {
         uint32_t key_size = avio_rb32(pb);
         uint32_t type = avio_rl32(pb);
-        if (key_size < 8) {
+        if (key_size < 8 || key_size > atom.size) {
             av_log(c->fc, AV_LOG_ERROR,
                    "The key# %"PRIu32" in meta has invalid size:"
                    "%"PRIu32"\n", i, key_size);
             return AVERROR_INVALIDDATA;
         }
+        atom.size -= key_size;
         key_size -= 8;
         if (type != MKTAG('m','d','t','a')) {
             avio_skip(pb, key_size);
+            continue;
         }
         c->meta_keys[i] = av_mallocz(key_size + 1);
         if (!c->meta_keys[i])
index 48bc3ad..9c27b79 100644 (file)
@@ -1,7 +1,7 @@
 Name:       ffmpeg
 Summary:    AV codec lib
 Version:    6.1
-Release:    2
+Release:    3
 Group:      Multimedia/Libraries
 URL:        https://ffmpeg.org/
 License:    LGPL-2.1+