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/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1
@ 2022-12-06 23:48 Michael Niedermayer
  2022-12-06 23:48 ` [FFmpeg-devel] [PATCH 2/2] avutil/tx_template: Use more unsigned ints to avoid undefined overflows Michael Niedermayer
  2022-12-25 18:37 ` [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 Michael Niedermayer
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Niedermayer @ 2022-12-06 23:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 53876/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-6569754750222336

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

diff --git a/libavcodec/dts2pts_bsf.c b/libavcodec/dts2pts_bsf.c
index 522d5e1eb0..48612e59db 100644
--- a/libavcodec/dts2pts_bsf.c
+++ b/libavcodec/dts2pts_bsf.c
@@ -461,9 +461,10 @@ static int dts2pts_filter(AVBSFContext *ctx, AVPacket *out)
                 poc_node = av_tree_find(s->root, &dup, cmp_find, NULL);
             }
         }
-    } else {
+    } else if (s->eof && frame.poc > INT_MIN) {
         DTS2PTSFrame dup = (DTS2PTSFrame) { NULL, frame.poc - 1, frame.poc_diff, frame.gop };
-        if (s->eof && (poc_node = av_tree_find(s->root, &dup, cmp_find, NULL)) && poc_node->poc == dup.poc) {
+        poc_node = av_tree_find(s->root, &dup, cmp_find, NULL);
+        if (poc_node && poc_node->poc == dup.poc) {
             out->pts = poc_node->dts;
             if (out->pts != AV_NOPTS_VALUE)
                 out->pts += poc_node->duration;
@@ -480,7 +481,8 @@ static int dts2pts_filter(AVBSFContext *ctx, AVPacket *out)
                        poc_node->poc, poc_node->gop, poc_node->dts, poc_node->duration);
         } else
             av_log(ctx, AV_LOG_WARNING, "No timestamp for POC %d in tree\n", frame.poc);
-    }
+    } else
+        av_log(ctx, AV_LOG_WARNING, "No timestamp for POC %d in tree\n", frame.poc);
     av_log(ctx, AV_LOG_DEBUG, "Returning frame for POC %d, GOP %d, dts %"PRId64", pts %"PRId64"\n",
            frame.poc, frame.gop, out->dts, out->pts);
 
-- 
2.17.1

_______________________________________________
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] 3+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] avutil/tx_template: Use more unsigned ints to avoid undefined overflows
  2022-12-06 23:48 [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 Michael Niedermayer
@ 2022-12-06 23:48 ` Michael Niedermayer
  2022-12-25 18:37 ` [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 Michael Niedermayer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2022-12-06 23:48 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: signed integer overflow: 574590586 - -1875616554 cannot be represented in type 'int'
Fixes: 53914/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5037125846564864

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

diff --git a/libavutil/tx_template.c b/libavutil/tx_template.c
index ac3dc22a2c..983de75a47 100644
--- a/libavutil/tx_template.c
+++ b/libavutil/tx_template.c
@@ -659,7 +659,7 @@ static void TX_NAME(ff_tx_fft8_ns)(AVTXContext *s, void *_dst,
 {
     TXComplex *src = _src;
     TXComplex *dst = _dst;
-    TXSample t1, t2, t3, t4, t5, t6, r0, i0, r1, i1;
+    TXUSample t1, t2, t3, t4, t5, t6, r0, i0, r1, i1;
     const TXSample cos = TX_TAB(ff_tx_tab_8)[1];
 
     TX_NAME(ff_tx_fft4_ns)(s, dst, src, stride);
@@ -680,7 +680,7 @@ static void TX_NAME(ff_tx_fft16_ns)(AVTXContext *s, void *_dst,
     TXComplex *dst = _dst;
     const TXSample *cos = TX_TAB(ff_tx_tab_16);
 
-    TXSample t1, t2, t3, t4, t5, t6, r0, i0, r1, i1;
+    TXUSample t1, t2, t3, t4, t5, t6, r0, i0, r1, i1;
     TXSample cos_16_1 = cos[1];
     TXSample cos_16_2 = cos[2];
     TXSample cos_16_3 = cos[3];
-- 
2.17.1

_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1
  2022-12-06 23:48 [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 Michael Niedermayer
  2022-12-06 23:48 ` [FFmpeg-devel] [PATCH 2/2] avutil/tx_template: Use more unsigned ints to avoid undefined overflows Michael Niedermayer
@ 2022-12-25 18:37 ` Michael Niedermayer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2022-12-25 18:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Wed, Dec 07, 2022 at 12:48:07AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
> Fixes: 53876/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-6569754750222336
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/dts2pts_bsf.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

will apply patchset

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras

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

end of thread, other threads:[~2022-12-25 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 23:48 [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 Michael Niedermayer
2022-12-06 23:48 ` [FFmpeg-devel] [PATCH 2/2] avutil/tx_template: Use more unsigned ints to avoid undefined overflows Michael Niedermayer
2022-12-25 18:37 ` [FFmpeg-devel] [PATCH 1/2] avcodec/dts2pts_bsf: Avoid searching for poc == INT_MIN-1 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