* [FFmpeg-devel] [PATCH] libavformat/asfdec: Fix regression bug when reading image attachments
@ 2025-04-20 1:56 softworkz
2025-04-20 22:09 ` [FFmpeg-devel] [PATCH v2] " softworkz
0 siblings, 1 reply; 2+ messages in thread
From: softworkz @ 2025-04-20 1:56 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
Commit c8140fe7324f264faacf7395b27e12531d1f13f7 had introduced
a check for value_len > UINT16_MAX.
As a consequence, attached images of sizes larger than UINT16_MAX
could no longer be read.
This is a minimal fix of the regression, avoiding the controversies
of my earlier submission regarding int type handling in asfdec.
Signed-off-by: softworkz <softworkz@hotmail.com>
---
libavformat/asfdec: Fix regression bug when reading image attachments
Commit c8140fe7324f264faacf7395b27e12531d1f13f7 had introduced a check
for value_len > UINT16_MAX. As a consequence, attached images of sizes
larger than UINT16_MAX could no longer be read.
This is a minimal fix of the regression, avoiding the controversies of
my earlier submission regarding int type handling in asfdec.
Signed-off-by: softworkz softworkz@hotmail.com
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-70%2Fsoftworkz%2Fsubmit_asf_attachments-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-70/softworkz/submit_asf_attachments-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/70
libavformat/asfdec_f.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 2441cadb44..ef5e5696c8 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -608,7 +608,8 @@ static int asf_read_metadata(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data;
- int n, stream_num, name_len_utf16, name_len_utf8, value_len;
+ int n, stream_num, name_len_utf16, name_len_utf8;
+ unsigned int value_len;
int ret, i;
n = avio_rl16(pb);
@@ -622,7 +623,7 @@ static int asf_read_metadata(AVFormatContext *s)
value_type = avio_rl16(pb); /* value_type */
value_len = avio_rl32(pb);
- if (value_len < 0 || value_len > UINT16_MAX)
+ if (value_len < 0 || value_len >= (INT_MAX - LEN) / 2)
return AVERROR_INVALIDDATA;
name_len_utf8 = 2*name_len_utf16 + 1;
base-commit: 7cd1edeaa410d977a9f1ff8436f480cb45b80178
--
ffmpeg-codebot
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* [FFmpeg-devel] [PATCH v2] libavformat/asfdec: Fix regression bug when reading image attachments
2025-04-20 1:56 [FFmpeg-devel] [PATCH] libavformat/asfdec: Fix regression bug when reading image attachments softworkz
@ 2025-04-20 22:09 ` softworkz
0 siblings, 0 replies; 2+ messages in thread
From: softworkz @ 2025-04-20 22:09 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
Commit c8140fe7324f264faacf7395b27e12531d1f13f7 had introduced
a check for value_len > UINT16_MAX.
As a consequence, attached images of sizes larger than UINT16_MAX
could no longer be read.
This is a minimal fix of the regression, avoiding the controversies
of my earlier submission regarding int type handling in asfdec.
Signed-off-by: softworkz <softworkz@hotmail.com>
---
libavformat/asfdec: Fix regression bug when reading image attachments
Commit c8140fe7324f264faacf7395b27e12531d1f13f7 had introduced a check
for value_len > UINT16_MAX. As a consequence, attached images of sizes
larger than UINT16_MAX could no longer be read.
This is a minimal fix of the regression, avoiding the controversies of
my earlier submission regarding int type handling in asfdec.
Signed-off-by: softworkz softworkz@hotmail.com
Versions
========
V2
==
* Fix "new warning" detected by Patchwork
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-70%2Fsoftworkz%2Fsubmit_asf_attachments-v2
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-70/softworkz/submit_asf_attachments-v2
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/70
Range-diff vs v1:
1: a5ce9d3d37 ! 1: 794108ed4e libavformat/asfdec: Fix regression bug when reading image attachments
@@ libavformat/asfdec_f.c: static int asf_read_metadata(AVFormatContext *s)
value_len = avio_rl32(pb);
- if (value_len < 0 || value_len > UINT16_MAX)
-+ if (value_len < 0 || value_len >= (INT_MAX - LEN) / 2)
++ if (value_len >= (INT_MAX - LEN) / 2)
return AVERROR_INVALIDDATA;
name_len_utf8 = 2*name_len_utf16 + 1;
libavformat/asfdec_f.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index 2441cadb44..ea6e8ef4f3 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -608,7 +608,8 @@ static int asf_read_metadata(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data;
- int n, stream_num, name_len_utf16, name_len_utf8, value_len;
+ int n, stream_num, name_len_utf16, name_len_utf8;
+ unsigned int value_len;
int ret, i;
n = avio_rl16(pb);
@@ -622,7 +623,7 @@ static int asf_read_metadata(AVFormatContext *s)
value_type = avio_rl16(pb); /* value_type */
value_len = avio_rl32(pb);
- if (value_len < 0 || value_len > UINT16_MAX)
+ if (value_len >= (INT_MAX - LEN) / 2)
return AVERROR_INVALIDDATA;
name_len_utf8 = 2*name_len_utf16 + 1;
base-commit: 7cd1edeaa410d977a9f1ff8436f480cb45b80178
--
ffmpeg-codebot
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-20 22:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-20 1:56 [FFmpeg-devel] [PATCH] libavformat/asfdec: Fix regression bug when reading image attachments softworkz
2025-04-20 22:09 ` [FFmpeg-devel] [PATCH v2] " softworkz
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git