Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally
@ 2024-07-17 11:27 Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: Reorder elements of expression in bisect loop Michael Niedermayer
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-17 11:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 68550/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6424065930756096

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavutil/timecode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index bd879bd3cc0..f40a10eb385 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -100,11 +100,12 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss
     return tc;
 }
 
-char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum)
+char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
 {
     int fps = tc->fps;
     int drop = tc->flags & AV_TIMECODE_FLAG_DROPFRAME;
     int hh, mm, ss, ff, ff_len, neg = 0;
+    int64_t framenum = framenum_arg;
 
     framenum += tc->start;
     if (drop)
-- 
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: Reorder elements of expression in bisect loop
  2024-07-17 11:27 [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally Michael Niedermayer
@ 2024-07-17 11:27 ` Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer Michael Niedermayer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-17 11:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 68578/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6032171648221184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mxfdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index a5863445ab5..af0c8a31007 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3821,8 +3821,7 @@ static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_
 
     a = -1;
     b = track->original_duration;
-
-    while (b - a > 1) {
+    while (b - 1 > a) {
         m = (a + b) >> 1;
         if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0)
             return -1;
-- 
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer
  2024-07-17 11:27 [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: Reorder elements of expression in bisect loop Michael Niedermayer
@ 2024-07-17 11:27 ` Michael Niedermayer
  2024-07-21 13:36   ` Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 4/5] swscale/output: Fix integer overflows in yuv2rgba64_X_c_template Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 5/5] avformat/iamf_parse: Check for negative sample sizes Michael Niedermayer
  3 siblings, 1 reply; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-17 11:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: dereferencing pointers near NULL
Fixes: 70432/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5255672845893632

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/iamfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c
index ce6d4aa0647..2e6608b8685 100644
--- a/libavformat/iamfdec.c
+++ b/libavformat/iamfdec.c
@@ -107,7 +107,7 @@ static int iamf_read_header(AVFormatContext *s)
             if (ret < 0)
                 return ret;
 
-            if (!i && !j && audio_element->layers[0].substream_count == 1)
+            if (!i && !j && audio_element->nb_layers && audio_element->layers[0].substream_count == 1)
                 st->disposition |= AV_DISPOSITION_DEFAULT;
             else
                 st->disposition |= AV_DISPOSITION_DEPENDENT;
-- 
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 4/5] swscale/output: Fix integer overflows in yuv2rgba64_X_c_template
  2024-07-17 11:27 [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: Reorder elements of expression in bisect loop Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer Michael Niedermayer
@ 2024-07-17 11:27 ` Michael Niedermayer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 5/5] avformat/iamf_parse: Check for negative sample sizes Michael Niedermayer
  3 siblings, 0 replies; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-17 11:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: signed integer overflow: -1082982400 + -1068681048 cannot be represented in type 'int'
Fixes: 69995/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6285740271534080

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libswscale/output.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index 0e6181b3e01..e8dd2145ce6 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1059,8 +1059,8 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
 
     for (i = 0; i < ((dstW + 1) >> 1); i++) {
         int j;
-        int Y1 = -0x40000000;
-        int Y2 = -0x40000000;
+        unsigned Y1 = -0x40000000;
+        unsigned Y2 = -0x40000000;
         int U  = -(128 << 23); // 19
         int V  = -(128 << 23);
         int R, G, B;
@@ -1088,9 +1088,9 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
         }
 
         // 8 bits: 12+15=27; 16 bits: 12+19=31
-        Y1 >>= 14; // 10
+        Y1 = (int)Y1 >> 14; // 10
         Y1 += 0x10000;
-        Y2 >>= 14;
+        Y2 = (int)Y2 >> 14;
         Y2 += 0x10000;
         U  >>= 14;
         V  >>= 14;
@@ -1109,20 +1109,20 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
         B =                            U * c->yuv2rgb_u2b_coeff;
 
         // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
-        output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
-        output_pixel(&dest[1], av_clip_uintp2(((  G + Y1) >> 14) + (1<<15), 16));
-        output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
+        output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
+        output_pixel(&dest[1], av_clip_uintp2(((int)(  G + Y1) >> 14) + (1<<15), 16));
+        output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
         if (eightbytes) {
             output_pixel(&dest[3], av_clip_uintp2(A1      , 30) >> 14);
-            output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((  G + Y2) >> 14) + (1<<15), 16));
-            output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[5], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
             output_pixel(&dest[7], av_clip_uintp2(A2      , 30) >> 14);
             dest += 8;
         } else {
-            output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
-            output_pixel(&dest[4], av_clip_uintp2(((  G + Y2) >> 14) + (1<<15), 16));
-            output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[4], av_clip_uintp2(((int)(  G + Y2) >> 14) + (1<<15), 16));
+            output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
             dest += 6;
         }
     }
-- 
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 5/5] avformat/iamf_parse: Check for negative sample sizes
  2024-07-17 11:27 [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally Michael Niedermayer
                   ` (2 preceding siblings ...)
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 4/5] swscale/output: Fix integer overflows in yuv2rgba64_X_c_template Michael Niedermayer
@ 2024-07-17 11:27 ` Michael Niedermayer
  3 siblings, 0 replies; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-17 11:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: index -2 out of bounds for type 'const enum AVCodecID [3]'
Fixes: 69866/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-4971166119821312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/iamf_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index a69d4a2f3a5..b3cf90467ba 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -146,7 +146,7 @@ static int ipcm_decoder_config(IAMFCodecConfig *codec_config,
     };
     int sample_format = avio_r8(pb); // 0 = BE, 1 = LE
     int sample_size = (avio_r8(pb) / 8 - 2); // 16, 24, 32
-    if (sample_format > 1 || sample_size > 2)
+    if (sample_format > 1 || sample_size > 2U)
         return AVERROR_INVALIDDATA;
 
     codec_config->codec_id = sample_fmt[sample_format][sample_size];
-- 
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] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer
  2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer Michael Niedermayer
@ 2024-07-21 13:36   ` Michael Niedermayer
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Niedermayer @ 2024-07-21 13:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 793 bytes --]

On Wed, Jul 17, 2024 at 01:27:43PM +0200, Michael Niedermayer wrote:
> Fixes: dereferencing pointers near NULL
> Fixes: 70432/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5255672845893632
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/iamfdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset, except this one (to give james a little more time to
review this)

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes

[-- 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] 6+ messages in thread

end of thread, other threads:[~2024-07-21 13:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-17 11:27 [FFmpeg-devel] [PATCH 1/5] avutil/timecode: Use a 64bit framenum internally Michael Niedermayer
2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 2/5] avformat/mxfdec: Reorder elements of expression in bisect loop Michael Niedermayer
2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 3/5] avformat/iamfdec: Check nb_layers before dereferencing layer Michael Niedermayer
2024-07-21 13:36   ` Michael Niedermayer
2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 4/5] swscale/output: Fix integer overflows in yuv2rgba64_X_c_template Michael Niedermayer
2024-07-17 11:27 ` [FFmpeg-devel] [PATCH 5/5] avformat/iamf_parse: Check for negative sample sizes 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