* [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks
@ 2024-06-07 23:18 Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly Michael Niedermayer
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-07 23:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
It is not entirely clear what would prevent such overflow so even if it is
not possible, it is better to use 64bit
Fixes: CID1491898 Unintentional integer overflow
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/rmdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 4ccb0895962..25a8681cfd3 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -268,9 +268,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
case DEINT_ID_INT4:
if (ast->coded_framesize > ast->audio_framesize ||
sub_packet_h <= 1 ||
- ast->coded_framesize * (uint64_t)sub_packet_h > (2 + (sub_packet_h & 1)) * ast->audio_framesize)
+ ast->coded_framesize * (uint64_t)sub_packet_h > (2LL + (sub_packet_h & 1)) * ast->audio_framesize)
return AVERROR_INVALIDDATA;
- if (ast->coded_framesize * (uint64_t)sub_packet_h != 2*ast->audio_framesize) {
+ if (ast->coded_framesize * (uint64_t)sub_packet_h != 2LL*ast->audio_framesize) {
avpriv_request_sample(s, "mismatching interleaver parameters");
return AVERROR_INVALIDDATA;
}
--
2.45.2
_______________________________________________
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] 5+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly
2024-06-07 23:18 [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
@ 2024-06-07 23:18 ` Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 3/4] avformat/rtmpproto: Use AV_DICT_MATCH_CASE instead of litteral number Michael Niedermayer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-07 23:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found while reviewing: CID1530313 Untrusted loop bound
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/rtmppkt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index bb7e6d20bc8..ec10c89fc8a 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -440,7 +440,6 @@ static int amf_tag_skip(GetByteContext *gb)
{
AMFDataType type;
unsigned nb = -1;
- int parse_key = 1;
if (bytestream2_get_bytes_left(gb) < 1)
return -1;
@@ -465,13 +464,12 @@ static int amf_tag_skip(GetByteContext *gb)
bytestream2_skip(gb, 10);
return 0;
case AMF_DATA_TYPE_ARRAY:
- parse_key = 0;
case AMF_DATA_TYPE_MIXEDARRAY:
nb = bytestream2_get_be32(gb);
case AMF_DATA_TYPE_OBJECT:
- while (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY) {
+ while (type != AMF_DATA_TYPE_ARRAY || nb-- > 0) {
int t;
- if (parse_key) {
+ if (type != AMF_DATA_TYPE_ARRAY) {
int size = bytestream2_get_be16(gb);
if (!size) {
bytestream2_get_byte(gb);
--
2.45.2
_______________________________________________
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] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] avformat/rtmpproto: Use AV_DICT_MATCH_CASE instead of litteral number
2024-06-07 23:18 [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly Michael Niedermayer
@ 2024-06-07 23:18 ` Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 4/4] avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset Michael Niedermayer
2024-07-10 19:44 ` [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-07 23:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found by reviewing: CID1530166 Free of array-typed value
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/rtmpproto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index bc3d9df7b9f..b3b1eedacb2 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -2668,7 +2668,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags, AVDictionary **o
}
if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) {
if (!strcmp(proto, "rtmpts"))
- av_dict_set(opts, "ffrtmphttp_tls", "1", 1);
+ av_dict_set(opts, "ffrtmphttp_tls", "1", AV_DICT_MATCH_CASE);
/* open the http tunneling connection */
ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
--
2.45.2
_______________________________________________
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] 5+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset
2024-06-07 23:18 [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 3/4] avformat/rtmpproto: Use AV_DICT_MATCH_CASE instead of litteral number Michael Niedermayer
@ 2024-06-07 23:18 ` Michael Niedermayer
2024-07-10 19:44 ` [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-07 23:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Found while reviewing: CID1494441 Untrusted value as argument
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavformat/rtpenc_rfc4175.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c
index 257d072cd31..2120274f014 100644
--- a/libavformat/rtpenc_rfc4175.c
+++ b/libavformat/rtpenc_rfc4175.c
@@ -116,7 +116,7 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size,
int l_field;
int l_line;
int l_off;
- int copy_offset;
+ int64_t copy_offset;
length = (headers[0] << 8) | headers[1];
l_field = (headers[2] & 0x80) >> 7;
@@ -127,7 +127,7 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size,
if (interlaced)
l_line = 2 * l_line + l_field;
- copy_offset = (l_line * width + l_off) * pgroup / xinc;
+ copy_offset = (l_line * (int64_t)width + l_off) * pgroup / xinc;
if (copy_offset + length > size)
break;
memcpy (dest, buf + copy_offset, length);
--
2.45.2
_______________________________________________
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] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks
2024-06-07 23:18 [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
` (2 preceding siblings ...)
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 4/4] avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset Michael Niedermayer
@ 2024-07-10 19:44 ` Michael Niedermayer
3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-07-10 19:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 656 bytes --]
On Sat, Jun 08, 2024 at 01:18:00AM +0200, Michael Niedermayer wrote:
> It is not entirely clear what would prevent such overflow so even if it is
> not possible, it is better to use 64bit
>
> Fixes: CID1491898 Unintentional integer overflow
>
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavformat/rmdec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
will apply patchset
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2024-07-10 19:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-07 23:18 [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 2/4] avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 3/4] avformat/rtmpproto: Use AV_DICT_MATCH_CASE instead of litteral number Michael Niedermayer
2024-06-07 23:18 ` [FFmpeg-devel] [PATCH 4/4] avformat/rtpenc_rfc4175: Use 64bit in computation if copy_offset Michael Niedermayer
2024-07-10 19:44 ` [FFmpeg-devel] [PATCH 1/4] avformat/rmdec: use 64bit for audio_framesize checks Michael Niedermayer
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