已开启
fix CVE-2023-6604 #487
Funda Wang创建于 3 天前
fix CVE-2023-6604 #487
已开启
共 2 个文件变更+96-1
| @@ -0,0 +1,88 @@ | |||
| 1 | +From f60c294f6d4450eab500f18c17bd748e981c9493 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: Michael Niedermayer <michael@niedermayer.cc> | ||
| 3 | +Date: Thu, 11 Jul 2024 18:10:00 +0200 | ||
| 4 | +Subject: [PATCH] avformat/bintext: Check avio_size() return | ||
| 5 | + | ||
| 6 | +Fixes: CID1604503 Overflowed constant | ||
| 7 | +Fixes: CID1604566 Overflowed constant | ||
| 8 | + | ||
| 9 | +Sponsored-by: Sovereign Tech Fund | ||
| 10 | +Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> | ||
| 11 | +(cherry picked from commit bf61f811e73dc62d1b53ed4ef6044b4e9e195113) | ||
| 12 | +Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> | ||
| 13 | +--- | ||
| 14 | + libavformat/bintext.c | 26 ++++++++++++++++++++------ | ||
| 15 | + 1 file changed, 20 insertions(+), 6 deletions(-) | ||
| 16 | + | ||
| 17 | +diff --git a/libavformat/bintext.c b/libavformat/bintext.c | ||
| 18 | +index b6f14a03e5..a691018080 100644 | ||
| 19 | +--- a/libavformat/bintext.c | ||
| 20 | ++++ b/libavformat/bintext.c | ||
| 21 | + static int next_tag_read(AVFormatContext *avctx, uint64_t *fsize) | ||
| 22 | + AVIOContext *pb = avctx->pb; | ||
| 23 | + char buf[36]; | ||
| 24 | + int len; | ||
| 25 | +- uint64_t start_pos = avio_size(pb) - 256; | ||
| 26 | ++ int64_t start_pos = avio_size(pb); | ||
| 27 | + | ||
| 28 | +- avio_seek(pb, start_pos, SEEK_SET); | ||
| 29 | ++ if (start_pos < 256) | ||
| 30 | ++ return AVERROR_INVALIDDATA; | ||
| 31 | ++ | ||
| 32 | ++ avio_seek(pb, start_pos - 256, SEEK_SET); | ||
| 33 | + if (avio_read(pb, buf, sizeof(next_magic)) != sizeof(next_magic)) | ||
| 34 | + return -1; | ||
| 35 | + if (memcmp(buf, next_magic, sizeof(next_magic))) | ||
| 36 | + static int xbin_read_header(AVFormatContext *s) | ||
| 37 | + return AVERROR(EIO); | ||
| 38 | + | ||
| 39 | + if (pb->seekable & AVIO_SEEKABLE_NORMAL) { | ||
| 40 | +- bin->fsize = avio_size(pb) - 9 - st->codecpar->extradata_size; | ||
| 41 | ++ int64_t fsize = avio_size(pb); | ||
| 42 | ++ if (fsize < 9 + st->codecpar->extradata_size) | ||
| 43 | ++ return 0; | ||
| 44 | ++ bin->fsize = fsize - 9 - st->codecpar->extradata_size; | ||
| 45 | + ff_sauce_read(s, &bin->fsize, NULL, 0); | ||
| 46 | + avio_seek(pb, 9 + st->codecpar->extradata_size, SEEK_SET); | ||
| 47 | + } | ||
| 48 | + static int adf_read_header(AVFormatContext *s) | ||
| 49 | + | ||
| 50 | + if (pb->seekable & AVIO_SEEKABLE_NORMAL) { | ||
| 51 | + int got_width = 0; | ||
| 52 | +- bin->fsize = avio_size(pb) - 1 - 192 - 4096; | ||
| 53 | ++ int64_t fsize = avio_size(pb); | ||
| 54 | ++ if (fsize < 1 + 192 + 4096) | ||
| 55 | ++ return 0; | ||
| 56 | ++ bin->fsize = fsize - 1 - 192 - 4096; | ||
| 57 | + st->codecpar->width = 80<<3; | ||
| 58 | + ff_sauce_read(s, &bin->fsize, &got_width, 0); | ||
| 59 | + if (st->codecpar->width < 8) | ||
| 60 | + static int idf_read_header(AVFormatContext *s) | ||
| 61 | + AVIOContext *pb = s->pb; | ||
| 62 | + AVStream *st; | ||
| 63 | + int got_width = 0, ret; | ||
| 64 | ++ int64_t fsize; | ||
| 65 | + | ||
| 66 | + if (!(pb->seekable & AVIO_SEEKABLE_NORMAL)) | ||
| 67 | + return AVERROR(EIO); | ||
| 68 | + static int idf_read_header(AVFormatContext *s) | ||
| 69 | + st->codecpar->extradata[0] = 16; | ||
| 70 | + st->codecpar->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT; | ||
| 71 | + | ||
| 72 | +- avio_seek(pb, avio_size(pb) - 4096 - 48, SEEK_SET); | ||
| 73 | ++ fsize = avio_size(pb); | ||
| 74 | ++ if (fsize < 12 + 4096 + 48) | ||
| 75 | ++ return AVERROR_INVALIDDATA; | ||
| 76 | ++ bin->fsize = fsize - 12 - 4096 - 48; | ||
| 77 | ++ | ||
| 78 | ++ avio_seek(pb, bin->fsize + 12, SEEK_SET); | ||
| 79 | + | ||
| 80 | + if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0) | ||
| 81 | + return AVERROR(EIO); | ||
| 82 | + if (avio_read(pb, st->codecpar->extradata + 2, 48) < 0) | ||
| 83 | + return AVERROR(EIO); | ||
| 84 | + | ||
| 85 | +- bin->fsize = avio_size(pb) - 12 - 4096 - 48; | ||
| 86 | + ff_sauce_read(s, &bin->fsize, &got_width, 0); | ||
| 87 | + if (st->codecpar->width < 8) | ||
| 88 | + return AVERROR_INVALIDDATA; | ||
| @@ -64,7 +64,7 @@ | |||
| 64 | Summary: Digital VCR and streaming server | 64 | Summary: Digital VCR and streaming server |
| 65 | Name: ffmpeg%{?flavor} | 65 | Name: ffmpeg%{?flavor} |
| 66 | Version: 6.1.1 | 66 | Version: 6.1.1 |
| 67 | -Release: 49 | 67 | +Release: 50 |
| 68 | License: GPL-3.0-or-later | 68 | License: GPL-3.0-or-later |
| 69 | URL: http://ffmpeg.org/ | 69 | URL: http://ffmpeg.org/ |
| 70 | Source0: http://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz | 70 | Source0: http://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz |
| @@ -142,6 +142,7 @@ Patch69: CVE-2026-38346.patch | |||
| 142 | Patch70: CVE-2026-38347.patch | 142 | Patch70: CVE-2026-38347.patch |
| 143 | Patch71: CVE-2026-38348.patch | 143 | Patch71: CVE-2026-38348.patch |
| 144 | Patch72: CVE-2026-38349.patch | 144 | Patch72: CVE-2026-38349.patch |
| 145 | +Patch73: CVE-2023-6604.patch | ||
| 145 | 146 | ||
| 146 | Requires: %{name}-libs%{?_isa} = %{version}-%{release} | 147 | Requires: %{name}-libs%{?_isa} = %{version}-%{release} |
| 147 | %{?_with_cuda:BuildRequires: cuda-minimal-build-%{_cuda_version_rpm} cuda-drivers-devel} | 148 | %{?_with_cuda:BuildRequires: cuda-minimal-build-%{_cuda_version_rpm} cuda-drivers-devel} |
| @@ -475,6 +476,12 @@ install -pm755 tools/qt-faststart %{buildroot}%{_bindir} | |||
| 475 | 476 | ||
| 476 | 477 | ||
| 477 | %changelog | 478 | %changelog |
| 479 | +* Thu Sep 4 2026 Funda Wang <fundawang@yeah.net> - 6.1.1-50 | ||
| 480 | +- Type: CVE | ||
| 481 | +- ID: CVE-2023-6604 | ||
| 482 | +- SUG: NA | ||
| 483 | +- DESC: fix CVE-2023-6604 (XBIN demuxer DoS amplification: arbitrary data demuxed as XBIN without format validation, causing unexpected CPU load and storage consumption) | ||
| 484 | + | ||
| 478 | * Sun Aug 30 2026 Funda Wang <fundawang@yeah.net> - 6.1.1-49 | 485 | * Sun Aug 30 2026 Funda Wang <fundawang@yeah.net> - 6.1.1-49 |
| 479 | - Type: CVE | 486 | - Type: CVE |
| 480 | - ID: CVE-2026-18393, CVE-2026-38343, CVE-2026-38344, CVE-2026-38346, CVE-2026-38347, CVE-2026-38348, CVE-2026-38349 | 487 | - ID: CVE-2026-18393, CVE-2026-38343, CVE-2026-38344, CVE-2026-38346, CVE-2026-38347, CVE-2026-38348, CVE-2026-38349 |