[FFmpeg-cvslog] avformat/matroskadec: Fix declaration-after-statement warnings

2023-10-29 Thread Andreas Rheinhardt
ffmpeg | branch: release/5.1 | Andreas Rheinhardt 
 | Mon Oct  9 00:16:08 2023 +0200| 
[7739dabb89eee2501ccf65971fa959d6c7d9a425] | committer: Michael Niedermayer

avformat/matroskadec: Fix declaration-after-statement warnings

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Rheinhardt 
(cherry picked from commit 37b5f4a1f6a9c7c8f3620c6b1f7f2b0bb997e5d7)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7739dabb89eee2501ccf65971fa959d6c7d9a425
---

 libavformat/matroskadec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2ab344a47e..78a11262f1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -4192,14 +4192,13 @@ static int64_t 
webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
 int64_t pre_bytes, pre_ns;
 double pre_sec, prebuffer, bits_per_second;
 CueDesc desc_beg = get_cue_desc(s, time_ns, cues_start);
+// Start with the first Cue.
+CueDesc desc_end = desc_beg;
 
 if (time_ns > INT64_MAX - prebuffer_ns)
 return -1;
 prebuffered_ns = time_ns + prebuffer_ns;
 
-// Start with the first Cue.
-CueDesc desc_end = desc_beg;
-
 // Figure out how much data we have downloaded for the prebuffer. This 
will
 // be used later to adjust the bits per sample to try.
 while (desc_end.start_time_ns != -1 && desc_end.end_time_ns < 
prebuffered_ns) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/mxfdec: Check klv offset

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed Oct 18 01:39:16 2023 +0200| [905819d18a93c0fb3685e4ba22afeb7f5af89116] | 
committer: Michael Niedermayer

avformat/mxfdec: Check klv offset

Fixes: Assertion klv_offset >= mxf->run_in failed at libavformat/mxfdec.c:736
Fixes: 
62936/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5778404366221312.fuzz

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 70f5fa63258f548cd8d067d479658bae61711ff4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=905819d18a93c0fb3685e4ba22afeb7f5af89116
---

 libavformat/mxfdec.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 2b2cfba273..5185fb6cc4 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -445,12 +445,15 @@ static int mxf_read_sync(AVIOContext *pb, const uint8_t 
*key, unsigned size)
 return i == size;
 }
 
-static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
+static int klv_read_packet(MXFContext *mxf, KLVPacket *klv, AVIOContext *pb)
 {
 int64_t length, pos;
 if (!mxf_read_sync(pb, mxf_klv_key, 4))
 return AVERROR_INVALIDDATA;
 klv->offset = avio_tell(pb) - 4;
+if (klv->offset < mxf->run_in)
+return AVERROR_INVALIDDATA;
+
 memcpy(klv->key, mxf_klv_key, 4);
 avio_read(pb, klv->key + 4, 12);
 length = klv_decode_ber_length(pb);
@@ -3337,7 +3340,7 @@ static int mxf_seek_to_previous_partition(MXFContext *mxf)
 /* Make sure this is actually a PartitionPack, and if so parse it.
  * See deadlock2.mxf
  */
-if ((ret = klv_read_packet(, pb)) < 0) {
+if ((ret = klv_read_packet(mxf, , pb)) < 0) {
 av_log(mxf->fc, AV_LOG_ERROR, "failed to read PartitionPack KLV\n");
 return ret;
 }
@@ -3614,7 +3617,7 @@ static void mxf_read_random_index_pack(AVFormatContext *s)
 if (length < min_rip_length || length > max_rip_length)
 goto end;
 avio_seek(s->pb, file_size - length, SEEK_SET);
-if (klv_read_packet(, s->pb) < 0 ||
+if (klv_read_packet(mxf, , s->pb) < 0 ||
 !IS_KLV_KEY(klv.key, ff_mxf_random_index_pack_key))
 goto end;
 if (klv.next_klv != file_size || klv.length <= 4 || (klv.length - 4) % 12) 
{
@@ -3661,7 +3664,7 @@ static int mxf_read_header(AVFormatContext *s)
 while (!avio_feof(s->pb)) {
 const MXFMetadataReadTableEntry *metadata;
 
-if (klv_read_packet(, s->pb) < 0) {
+if (klv_read_packet(mxf, , s->pb) < 0) {
 /* EOF - seek to previous partition or stop */
 if(mxf_parse_handle_partition_or_eof(mxf) <= 0)
 break;
@@ -3910,7 +3913,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 if (pos < mxf->current_klv_data.next_klv - 
mxf->current_klv_data.length || pos >= mxf->current_klv_data.next_klv) {
 mxf->current_klv_data = (KLVPacket){{0}};
-ret = klv_read_packet(, s->pb);
+ret = klv_read_packet(mxf, , s->pb);
 if (ret < 0)
 break;
 max_data_size = klv.length;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/rtsp: Use rtsp_st->stream_index

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Oct 19 22:07:36 2023 +0200| [5e71da4ef9636966b7ec5f8910cf0e6dd4e941e6] | 
committer: Michael Niedermayer

avformat/rtsp: Use rtsp_st->stream_index

Fixes: out of array access
Fixes: rtpdec_h264.c149/poc

Found-by: Hardik Shah of Vehere
Reviewed-by: Martin Storsjö 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit e4d5ac8d7d2a08658b3db7dd821246fe6b35381f)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e71da4ef9636966b7ec5f8910cf0e6dd4e941e6
---

 libavformat/rtsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f948f1d395..4c8c7a186c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -409,7 +409,7 @@ static void parse_fmtp(AVFormatContext *s, RTSPState *rt,
 if (rtsp_st->sdp_payload_type == payload_type &&
 rtsp_st->dynamic_handler &&
 rtsp_st->dynamic_handler->parse_sdp_a_line) {
-rtsp_st->dynamic_handler->parse_sdp_a_line(s, i,
+rtsp_st->dynamic_handler->parse_sdp_a_line(s, 
rtsp_st->stream_index,
 rtsp_st->dynamic_protocol_context, line);
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/jpeg2000dec: Check image offset

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed Oct  4 23:32:17 2023 +0200| [4bd4b178bfa49fdaf2a0560e1c1cfc6dad0fcf6a] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Check image offset

Fixes: left shift of negative value -538967841
Fixes: 
62447/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-6427134337613824

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Tomas Härdin 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 88453250dbe952e85899d04867914ef95785530e)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bd4b178bfa49fdaf2a0560e1c1cfc6dad0fcf6a
---

 libavcodec/jpeg2000dec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index fc10bb8f0c..686a4f9758 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -323,6 +323,11 @@ static int get_siz(Jpeg2000DecoderContext *s)
 return AVERROR_INVALIDDATA;
 }
 
+if (s->image_offset_x >= s->width || s->image_offset_y >= s->height) {
+av_log(s->avctx, AV_LOG_ERROR, "image offsets outside image");
+return AVERROR_INVALIDDATA;
+}
+
 if (s->reduction_factor && (s->image_offset_x || s->image_offset_y) ){
 av_log(s->avctx, AV_LOG_ERROR, "reduction factor with image offsets is 
not fully implemented");
 return AVERROR_PATCHWELCOME;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined

2023-10-29 Thread Sean McGovern
ffmpeg | branch: release/5.1 | Sean McGovern  | Sat Oct 14 
23:27:24 2023 -0400| [f861a1602529aa4788f7df85eb9f00c6b861e760] | committer: 
Michael Niedermayer

libavutil/ppc/cpu.c: check that AT_HWCAP2 is defined

It was not introduced until glibc 2.18.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit d799ad24045f2ae005c8b4c90bee5330ff15fea8)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f861a1602529aa4788f7df85eb9f00c6b861e760
---

 libavutil/ppc/cpu.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/ppc/cpu.c b/libavutil/ppc/cpu.c
index 96b491c716..bc8bb5f47c 100644
--- a/libavutil/ppc/cpu.c
+++ b/libavutil/ppc/cpu.c
@@ -95,12 +95,15 @@ int ff_get_cpu_flags_ppc(void)
 #endif
 if (ret & AV_CPU_FLAG_VSX)
 av_assert0(ret & AV_CPU_FLAG_ALTIVEC);
-} else if (buf[i] == AT_HWCAP2) {
+}
+#ifdef AT_HWCAP2 /* not introduced until glibc 2.18 */
+else if (buf[i] == AT_HWCAP2) {
 #ifdef PPC_FEATURE2_ARCH_2_07
 if (buf[i + 1] & PPC_FEATURE2_ARCH_2_07)
 ret |= AV_CPU_FLAG_POWER8;
 #endif
 }
+#endif /* AT_HWCAP2 */
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/h2645_parse: Avoid EAGAIN

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Oct  1 19:28:55 2023 +0200| [181d6e17e07b19a04aaae637c1ce533a719ad88a] | 
committer: Michael Niedermayer

avcodec/h2645_parse: Avoid EAGAIN

EAGAIN causes an assertion failure when it is returned from the decoder

Fixes: Assertion consumed != (-(11)) failed at libavcodec/decode.c:462
Fixes: assertion_IOT_instruction_decode_c_462/poc

Found-by: Hardik Shah of Vehere (Dawn Treaders team)
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5ddab49d48343385eadb3a435a5491c476b66ecc)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=181d6e17e07b19a04aaae637c1ce533a719ad88a
---

 libavcodec/h2645_parse.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h2645_parse.h b/libavcodec/h2645_parse.h
index 787ce971ee..128dea09ef 100644
--- a/libavcodec/h2645_parse.h
+++ b/libavcodec/h2645_parse.h
@@ -123,7 +123,7 @@ static inline int get_nalsize(int nal_length_size, const 
uint8_t *buf,
 
 if (*buf_index >= buf_size - nal_length_size) {
 // the end of the buffer is reached, refill it
-return AVERROR(EAGAIN);
+return AVERROR_INVALIDDATA;
 }
 
 for (i = 0; i < nal_length_size; i++)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/xvididct: Make c* unsigned to avoid undefined overflows

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Oct  5 18:27:28 2023 +0200| [566e0aa8e22050c1c7ac4a87e4f4e262e2b94949] | 
committer: Michael Niedermayer

avcodec/xvididct: Make c* unsigned to avoid undefined overflows

Fixes: signed integer overflow: 1496950099 + 728014168 cannot be represented in 
type 'int'
Fixes: 
62667/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEGB_fuzzer-6511785170305024

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit f7e5537dc1ff2f45a6e4c98091f15e60c3647cfc)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=566e0aa8e22050c1c7ac4a87e4f4e262e2b94949
---

 libavcodec/xvididct.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index dcea32210a..01072d80ab 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -56,13 +56,13 @@ static const int TAB35[] = { 26722, 25172, 22654, 19266, 
15137, 10426, 5315 };
 
 static int idct_row(short *in, const int *const tab, int rnd)
 {
-const int c1 = tab[0];
-const int c2 = tab[1];
-const int c3 = tab[2];
-const int c4 = tab[3];
-const int c5 = tab[4];
-const int c6 = tab[5];
-const int c7 = tab[6];
+const unsigned c1 = tab[0];
+const unsigned c2 = tab[1];
+const unsigned c3 = tab[2];
+const unsigned c4 = tab[3];
+const unsigned c5 = tab[4];
+const unsigned c6 = tab[5];
+const unsigned c7 = tab[6];
 
 const int right = in[5] | in[6] | in[7];
 const int left  = in[1] | in[2] | in[3];
@@ -102,8 +102,8 @@ static int idct_row(short *in, const int *const tab, int 
rnd)
 return 0;
 }
 } else if (!(left | right)) {
-const int a0 = (rnd + c4 * (in[0] + in[4])) >> ROW_SHIFT;
-const int a1 = (rnd + c4 * (in[0] - in[4])) >> ROW_SHIFT;
+const int a0 = (int)(rnd + c4 * (in[0] + in[4])) >> ROW_SHIFT;
+const int a1 = (int)(rnd + c4 * (in[0] - in[4])) >> ROW_SHIFT;
 
 in[0] = a0;
 in[3] = a0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/tmv: Check video chunk size

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Mon Oct  9 00:07:32 2023 +0200| [d7f64a78e0d452e82be43abb3ee53f187cae86e5] | 
committer: Michael Niedermayer

avformat/tmv: Check video chunk size

This check matches the audio chunk check

Fixes: Timeout
Fixes: 
62681/clusterfuzz-testcase-minimized-ffmpeg_dem_TMV_fuzzer-5299107876700160

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b79fc7059600b28dce392fc20e5c8bd554c2fc95)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7f64a78e0d452e82be43abb3ee53f187cae86e5
---

 libavformat/tmv.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index ea39954190..18105f764e 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -103,6 +103,10 @@ static int tmv_read_header(AVFormatContext *s)
 char_cols = avio_r8(pb);
 char_rows = avio_r8(pb);
 tmv->video_chunk_size = char_cols * char_rows * 2;
+if (!tmv->video_chunk_size) {
+av_log(s, AV_LOG_ERROR, "invalid video chunk size\n");
+return AVERROR_INVALIDDATA;
+}
 
 features  = avio_r8(pb);
 if (features & ~(TMV_PADDING | TMV_STEREO)) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/h264_parser: saturate dts a bit

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Oct  1 00:07:20 2023 +0200| [76ee7c771568029f55fa8806315aeb4b7f149e71] | 
committer: Michael Niedermayer

avcodec/h264_parser: saturate dts a bit

Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented 
in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6112289464123392

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 7fedbc7606614cc1a6224effa8df762b6883bdc4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76ee7c771568029f55fa8806315aeb4b7f149e71
---

 libavcodec/h264_parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 50810f1789..0a2451a153 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -645,10 +645,10 @@ static int h264_parse(AVCodecParserContext *s,
 int64_t num = avctx->time_base.num * 
(int64_t)avctx->pkt_timebase.den;
 if (s->dts != AV_NOPTS_VALUE) {
 // got DTS from the stream, update reference timestamp
-p->reference_dts = s->dts - av_rescale(s->dts_ref_dts_delta, 
num, den);
+p->reference_dts = av_sat_sub64(s->dts, 
av_rescale(s->dts_ref_dts_delta, num, den));
 } else if (p->reference_dts != AV_NOPTS_VALUE) {
 // compute DTS based on reference timestamp
-s->dts = p->reference_dts + av_rescale(s->dts_ref_dts_delta, 
num, den);
+s->dts = av_sat_add64(p->reference_dts, 
av_rescale(s->dts_ref_dts_delta, num, den));
 }
 
 if (p->reference_dts != AV_NOPTS_VALUE && s->pts == AV_NOPTS_VALUE)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/asfdec_f: Saturate presentation time in marker

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Oct  1 00:00:28 2023 +0200| [a563efcfda67b56cc50d4c2f28b7e44fcafa464b] | 
committer: Michael Niedermayer

avformat/asfdec_f: Saturate presentation time in marker

Fixes: signed integer overflow: -9223372036315799520 - 3873890816 cannot be 
represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5009302746431488

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit cedb4736f568a9cc693f81b1f7c33ea2499715ab)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a563efcfda67b56cc50d4c2f28b7e44fcafa464b
---

 libavformat/asfdec_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index bdbd4271c8..aa7aaa6ab6 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -670,7 +670,7 @@ static int asf_read_marker(AVFormatContext *s)
 
 avio_rl64(pb); // offset, 8 bytes
 pres_time = avio_rl64(pb); // presentation time
-pres_time -= asf->hdr.preroll * 1;
+pres_time = av_sat_sub64(pres_time, asf->hdr.preroll * 1);
 avio_rl16(pb); // entry length
 avio_rl32(pb); // send time
 avio_rl32(pb); // flags

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/xwma: sanity check bits_per_coded_sample

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 23:55:20 2023 +0200| [29788ba10ec4824cafe2e154321c6f9a7a021743] | 
committer: Michael Niedermayer

avformat/xwma: sanity check bits_per_coded_sample

Fixes: signed integer overflow: 65312 * 524296 cannot be represented in type 
'int'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_XWMA_fuzzer-659597144200

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit fe6ce28d118d6030984e1ee5c2d92e98514fe3d1)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29788ba10ec4824cafe2e154321c6f9a7a021743
---

 libavformat/xwma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 12689f37fd..b830f9ed75 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -151,7 +151,7 @@ static int xwma_read_header(AVFormatContext *s)
st->codecpar->ch_layout.nb_channels);
 return AVERROR_INVALIDDATA;
 }
-if (!st->codecpar->bits_per_coded_sample) {
+if (!st->codecpar->bits_per_coded_sample || 
st->codecpar->bits_per_coded_sample > 64) {
 av_log(s, AV_LOG_WARNING, "Invalid bits_per_coded_sample: %d\n",
st->codecpar->bits_per_coded_sample);
 return AVERROR_INVALIDDATA;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/matroskadec: Check prebuffered_ns for overflow

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 23:44:25 2023 +0200| [f15a1d79280b929ad4cdfd5d40ae505af7c07cc9] | 
committer: Michael Niedermayer

avformat/matroskadec: Check prebuffered_ns for overflow

Fixes: signed integer overflow: 9223372036630775808 + 10 cannot be 
represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-5406131992526848

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 2d6df3719dd4f75b40cdf25a02f3f075b76ed045)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f15a1d79280b929ad4cdfd5d40ae505af7c07cc9
---

 libavformat/matroskadec.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index ad7ee390a2..2ab344a47e 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -4186,13 +4186,17 @@ static int64_t 
webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
 int64_t prebuffer_ns = 10;
 int64_t time_ns = sti->index_entries[i].timestamp * 
matroska->time_scale;
 double nano_seconds_per_second = 10.0;
-int64_t prebuffered_ns = time_ns + prebuffer_ns;
+int64_t prebuffered_ns;
 double prebuffer_bytes = 0.0;
 int64_t temp_prebuffer_ns = prebuffer_ns;
 int64_t pre_bytes, pre_ns;
 double pre_sec, prebuffer, bits_per_second;
 CueDesc desc_beg = get_cue_desc(s, time_ns, cues_start);
 
+if (time_ns > INT64_MAX - prebuffer_ns)
+return -1;
+prebuffered_ns = time_ns + prebuffer_ns;
+
 // Start with the first Cue.
 CueDesc desc_end = desc_beg;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/wavdec: Check left avio_tell for overflow

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 21:33:34 2023 +0200| [1718baf61c118eda4119f7de37696fb3b497fa3b] | 
committer: Michael Niedermayer

avformat/wavdec: Check left avio_tell for overflow

Fixes: signed integer overflow: 155 + 9223372036854775655 cannot be represented 
in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5364032278495232

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 929ddef3f40102d6a84cfa17ed7c7ffebcf8236e)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1718baf61c118eda4119f7de37696fb3b497fa3b
---

 libavformat/wavdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 7d16b25e54..1c4883ea1b 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -767,6 +767,8 @@ smv_out:
 goto smv_retry;
 return AVERROR_EOF;
 }
+if (INT64_MAX - left < avio_tell(s->pb))
+return AVERROR_INVALIDDATA;
 wav->data_end = avio_tell(s->pb) + left;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/tta: Better totalframes check

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 21:28:55 2023 +0200| [c01d304a6bf1967cd232b36950a94e5fcf6ab058] | 
committer: Michael Niedermayer

avformat/tta: Better totalframes check

Fixes: signed integer overflow: 4 * 740491135 cannot be represented in type 
'int'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-6298893367508992

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5f0d00464a50994de0993e045e09313ca8d7cc8f)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c01d304a6bf1967cd232b36950a94e5fcf6ab058
---

 libavformat/tta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tta.c b/libavformat/tta.c
index 2183045940..5477654014 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s)
 c->totalframes = nb_samples / c->frame_size + (c->last_frame_size < 
c->frame_size);
 c->currentframe = 0;
 
-if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){
+if(c->totalframes >= (INT_MAX - 4)/sizeof(uint32_t) || c->totalframes <= 
0){
 av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes);
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/rpl: Check for number_of_chunks overflow

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 21:14:28 2023 +0200| [0c1babaa61948e7d581982494038c5e8f73fb760] | 
committer: Michael Niedermayer

avformat/rpl: Check for number_of_chunks overflow

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 
'int32_t' (aka 'int')
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-6086131095830528

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b3c973acbecb879d4949fecdadd2fdfc08dea42b)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c1babaa61948e7d581982494038c5e8f73fb760
---

 libavformat/rpl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 3ef6fda386..eae0da891b 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -268,6 +268,9 @@ static int rpl_read_header(AVFormatContext *s)
"Video stream will be broken!\n", 
av_fourcc2str(vst->codecpar->codec_tag));
 
 number_of_chunks = read_line_and_int(pb, );  // number of chunks in 
the file
+if (number_of_chunks == INT_MAX)
+return AVERROR_INVALIDDATA;
+
 // The number in the header is actually the index of the last chunk.
 number_of_chunks++;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/mov: compute absolute dts difference without overflow in mov_find_next_sample()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 21:04:11 2023 +0200| [1e239a8b88edfacfe15efc4d6215c09df0d927a3] | 
committer: Michael Niedermayer

avformat/mov: compute absolute dts difference without overflow in 
mov_find_next_sample()

Fixes: signed integer overflow: -9223372036854775808 - 922272641302200 
cannot be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5959420033761280

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3508b496e195440d0af0203e2822937b8c6f5598)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e239a8b88edfacfe15efc4d6215c09df0d927a3
---

 libavformat/mov.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 88fbfbcb5d..0d2ca6b9f5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8550,12 +8550,13 @@ static AVIndexEntry 
*mov_find_next_sample(AVFormatContext *s, AVStream **st)
 if (msc->pb && msc->current_sample < avsti->nb_index_entries) {
 AVIndexEntry *current_sample = 
>index_entries[msc->current_sample];
 int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, 
msc->time_scale);
+uint64_t dtsdiff = best_dts > dts ? best_dts - (uint64_t)dts : 
((uint64_t)dts - best_dts);
 av_log(s, AV_LOG_TRACE, "stream %d, sample %d, dts %"PRId64"\n", 
i, msc->current_sample, dts);
 if (!sample || (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && 
current_sample->pos < sample->pos) ||
 ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) &&
  ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && 
dts != AV_NOPTS_VALUE &&
- ((FFABS(best_dts - dts) <= AV_TIME_BASE && 
current_sample->pos < sample->pos) ||
-  (FFABS(best_dts - dts) > AV_TIME_BASE && dts < 
best_dts)) {
+ ((dtsdiff <= AV_TIME_BASE && current_sample->pos < 
sample->pos) ||
+  (dtsdiff > AV_TIME_BASE && dts < best_dts)) {
 sample = current_sample;
 best_dts = dts;
 *st = avst;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jacosubdec: Check timeres

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 19:59:06 2023 +0200| [283baa733661174a53087146402fe911c88599a6] | 
committer: Michael Niedermayer

avformat/jacosubdec: Check timeres

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 51f0ab8b127282415822959ccad7db95ad749b5d)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=283baa733661174a53087146402fe911c88599a6
---

 libavformat/jacosubdec.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 41216081ee..c6e5b4aa6d 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -227,14 +227,17 @@ static int jacosub_read_header(AVFormatContext *s)
 }
 av_bprintf(, "#S %s", p);
 break;
-case 'T': // ...but must be placed after TIMERES
-jacosub->timeres = strtol(p, NULL, 10);
-if (!jacosub->timeres)
+case 'T': { // ...but must be placed after TIMERES
+int64_t timeres = strtol(p, NULL, 10);
+if (timeres <= 0 || timeres > UINT32_MAX) {
 jacosub->timeres = 30;
-else
+} else {
+jacosub->timeres = timeres;
 av_bprintf(, "#T %s", p);
+}
 break;
 }
+}
 }
 
 /* general/essential directives in the extradata */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jacosubdec: Factorize code in get_shift() a bit

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 19:34:29 2023 +0200| [d35579c12b603620c9b8522039ffde287e0eb156] | 
committer: Michael Niedermayer

avformat/jacosubdec: Factorize code in get_shift() a bit

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6490b9aed63c06f20bbc46e0bc801e612d07e81e)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d35579c12b603620c9b8522039ffde287e0eb156
---

 libavformat/jacosubdec.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 61b1316dc9..42c201f93a 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -143,16 +143,12 @@ static int get_shift(int timeres, const char *buf)
 
 ret = 0;
 switch (n) {
-case 4:
-ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
-break;
-case 3:
-ret = sign * (( (int64_t)a*60 + b) * timeres + c);
-break;
-case 2:
-ret = sign * (((int64_t)a) * timeres + b);
-break;
+case 1:  a = 0;
+case 2:c = b; b = a; a = 0;
+case 3: d = c; c = b; b = a; a = 0;
 }
+
+ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
 if ((int)ret != ret)
 ret = 0;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jacosubdec: avoid signed integer overflows in get_shift()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 19:48:17 2023 +0200| [441d5eca4b659ad27704315659311945662b8db2] | 
committer: Michael Niedermayer

avformat/jacosubdec: avoid signed integer overflows in get_shift()

Fixes: signed integer overflow: 22014562800 * 934633746 cannot be represented 
in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-5189603246866432

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 32447b149fb61eb48436eddbbb1adf91b70ec5e4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=441d5eca4b659ad27704315659311945662b8db2
---

 libavformat/jacosubdec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 42c201f93a..41216081ee 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -124,7 +124,7 @@ shift_and_ret:
 return buf + len;
 }
 
-static int get_shift(int timeres, const char *buf)
+static int get_shift(unsigned timeres, const char *buf)
 {
 int sign = 1;
 int a = 0, b = 0, c = 0, d = 0;
@@ -148,7 +148,11 @@ static int get_shift(int timeres, const char *buf)
 case 3: d = c; c = b; b = a; a = 0;
 }
 
-ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
+ret = (int64_t)a*3600 + (int64_t)b*60 + c;
+if (FFABS(ret) > (INT64_MAX - FFABS(d)) / timeres)
+return 0;
+ret = sign * (ret * timeres + d);
+
 if ((int)ret != ret)
 ret = 0;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/sbgdec: Check for negative duration or un-representable end pts

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Oct  1 00:30:39 2023 +0200| [30b3f2712d585fe2c77daa1bb073341c4d1aa5d9] | 
committer: Michael Niedermayer

avformat/sbgdec: Check for negative duration or un-representable end pts

Fixes: signed integer overflow: 9230955872951340 - -9223372036854775808 cannot 
be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6330481893572608

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 9b00b5734d9868971cb6e6cda0f3b8eeed93be9e)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30b3f2712d585fe2c77daa1bb073341c4d1aa5d9
---

 libavformat/sbgdec.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 9f1d399361..1ef50e1598 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -1461,6 +1461,13 @@ static av_cold int sbg_read_header(AVFormatContext *avf)
 st->duration  = script.end_ts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE :
 av_rescale(script.end_ts - script.start_ts,
sbg->sample_rate, AV_TIME_BASE);
+
+if (st->duration != AV_NOPTS_VALUE && (
+st->duration < 0 || st->start_time > INT64_MAX - st->duration)) {
+r = AVERROR_INVALIDDATA;
+goto fail;
+}
+
 sti->cur_dts  = st->start_time;
 r = encode_intervals(, st->codecpar, );
 if (r < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/escape124: Do not return random numbers

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Sep 17 00:21:52 2023 +0200| [44978c5b833304744ac47c0f45dd5f60736e156d] | 
committer: Michael Niedermayer

avcodec/escape124: Do not return random numbers

Fixes: out of array access
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6035022714634240
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-6422176201572352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit fe6d46490f5ea9155fe0601b6246960ae17317fc)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44978c5b833304744ac47c0f45dd5f60736e156d
---

 libavcodec/escape124.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 16626ad5b7..de1b195172 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -237,7 +237,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 if ((ret = av_frame_ref(frame, s->frame)) < 0)
 return ret;
 
-return frame_size;
+return 0;
 }
 
 for (i = 0; i < 3; i++) {
@@ -371,7 +371,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 
 *got_frame = 1;
 
-return frame_size;
+return 0;
 }
 
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] tools/target_dec_fuzzer: Adjust wmapro threshold

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 16 22:58:07 2023 +0200| [43c6fabb63e6b5db65ea531c8e462656976de9dc] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust wmapro threshold

Fixes: Timeout
Fixes: 
62266/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5125460729921536

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit bb9f8a1cb7d7b5e3742fe2212c144efea258f3d0)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43c6fabb63e6b5db65ea531c8e462656976de9dc
---

 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index e03c1ecbec..dabb305ba0 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -294,6 +294,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_WMV3:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_WS_VQA:  maxpixels  /= 16384; break;
 case AV_CODEC_ID_WMALOSSLESS: maxsamples /= 1024;  break;
+case AV_CODEC_ID_WMAPRO:  maxsamples /= 16384; break;
 case AV_CODEC_ID_YLC: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_ZEROCODEC:   maxpixels  /= 128;   break;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/apedec: Fix an integer overflow in predictor_update_filter()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 16 23:36:29 2023 +0200| [95b2569427d8974b570afe209c3de9215ba9c985] | 
committer: Michael Niedermayer

avcodec/apedec: Fix an integer overflow in predictor_update_filter()

Fixes: signed integer overflow: -2147483506 + -801380 cannot be represented in 
type 'int'
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6578985923117056

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 515c0247a3062ca4639e457c81d2f58c504e9e8f)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95b2569427d8974b570afe209c3de9215ba9c985
---

 libavcodec/apedec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 8aca605343..8488f97a77 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1202,7 +1202,7 @@ static av_always_inline int 
predictor_update_filter(APEPredictor64 *p,
 if (compression_level < COMPRESSION_LEVEL_INSANE) {
 predictionA = (int32_t)predictionA;
 predictionB = (int32_t)predictionB;
-p->lastA[filter] = decoded + ((int32_t)(predictionA + (predictionB >> 
1)) >> 10);
+p->lastA[filter] = (int32_t)(decoded + 
(unsigned)((int32_t)(predictionA + (predictionB >> 1)) >> 10));
 } else {
 p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + 
(predictionB >> 1)) >> 10);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/avs: Check if return code is representable

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed Sep 20 01:32:56 2023 +0200| [3817209b6d379ec8bc7d07997aba1b5295590843] | 
committer: Michael Niedermayer

avformat/avs: Check if return code is representable

Fixes: leak
Fixes: 
62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 52d666edec73c834c60811e330f86a7cf1d916da)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3817209b6d379ec8bc7d07997aba1b5295590843
---

 libavformat/avs.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/avs.c b/libavformat/avs.c
index ab47980a11..19f0373157 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -140,6 +140,10 @@ static int avs_read_audio_packet(AVFormatContext * s, 
AVPacket * pkt)
 return 0;/* this indicate EOS */
 if (ret < 0)
 return ret;
+if (size != (int)size) {
+av_packet_unref(pkt);
+return AVERROR(EDOM);
+}
 
 pkt->stream_index = avs->st_audio->index;
 pkt->flags |= AV_PKT_FLAG_KEY;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/lcldec: Make PNG filter addressing match the code afterwards

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Jun  1 00:50:15 2023 +0200| [6e4690ede0fa745d1a466cf4e31ed9950277ccdc] | 
committer: Michael Niedermayer

avcodec/lcldec: Make PNG filter addressing match the code afterwards

Also update check accordingly

Fixes: tickets/10237/mszh_306_306_yuv422_nocompress.avi
Fixes: tickets/10237/mszh_306_306_yuv411_nocompress.avi

Signed-off-by: Michael Niedermayer 
(cherry picked from commit d11b8bd0c610c212d2a28767f94dc07a8ec473cf)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e4690ede0fa745d1a466cf4e31ed9950277ccdc
---

 libavcodec/lcldec.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 1c52700762..3555a26241 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -229,16 +229,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 break;
 case COMP_MSZH_NOCOMP: {
 int bppx2;
+int aligned_width = width;
 switch (c->imgtype) {
 case IMGTYPE_YUV111:
 case IMGTYPE_RGB24:
 bppx2 = 6;
 break;
 case IMGTYPE_YUV422:
+aligned_width &= ~3;
 case IMGTYPE_YUV211:
 bppx2 = 4;
 break;
 case IMGTYPE_YUV411:
+aligned_width &= ~3;
 case IMGTYPE_YUV420:
 bppx2 = 3;
 break;
@@ -246,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 bppx2 = 0; // will error out below
 break;
 }
-if (len < ((width * height * bppx2) >> 1))
+if (len < ((aligned_width * height * bppx2) >> 1))
 return AVERROR_INVALIDDATA;
 break;
 }
@@ -312,8 +315,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 }
 break;
 case IMGTYPE_YUV422:
+pixel_ptr = 0;
 for (row = 0; row < height; row++) {
-pixel_ptr = row * width * 2;
 yq = uq = vq =0;
 for (col = 0; col < width/4; col++) {
 encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
@@ -329,8 +332,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 }
 break;
 case IMGTYPE_YUV411:
+pixel_ptr = 0;
 for (row = 0; row < height; row++) {
-pixel_ptr = row * width / 2 * 3;
 yq = uq = vq =0;
 for (col = 0; col < width/4; col++) {
 encoded[pixel_ptr] = yq -= encoded[pixel_ptr];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/westwood_vqa: Check chunk size

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Sep 22 20:08:52 2022 +0200| [87f556a10c1c031c0837b7ad740e2ddc18595282] | 
committer: Michael Niedermayer

avformat/westwood_vqa: Check chunk size

the type is also changed to int as it is interpreted as int in av_get_packet()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 
'int'
Fixes: 
50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-6593408795279360
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_WSVQA_fuzzer-4613908817903616

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Anton Khirnov 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5c0df3da0b7288a43a3b783117064cfcbc8037a5)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87f556a10c1c031c0837b7ad740e2ddc18595282
---

 libavformat/westwood_vqa.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index e3d2e2668c..03b2d9e03c 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -178,13 +178,15 @@ static int wsvqa_read_packet(AVFormatContext *s,
 int ret = -1;
 uint8_t preamble[VQA_PREAMBLE_SIZE];
 uint32_t chunk_type;
-uint32_t chunk_size;
-int skip_byte;
+int chunk_size;
+unsigned skip_byte;
 
 while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
 chunk_type = AV_RB32([0]);
 chunk_size = AV_RB32([4]);
 
+if (chunk_size < 0)
+return AVERROR_INVALIDDATA;
 skip_byte = chunk_size & 0x01;
 
 if (chunk_type == VQFL_TAG) {
@@ -193,9 +195,9 @@ static int wsvqa_read_packet(AVFormatContext *s,
  * so it can be combined with the next VQFR packet. This way each 
packet
  * includes a whole frame as expected. */
 wsvqa->vqfl_chunk_pos = avio_tell(pb);
-wsvqa->vqfl_chunk_size = (int)(chunk_size);
-if (wsvqa->vqfl_chunk_size < 0 || wsvqa->vqfl_chunk_size > 3 * (1 
<< 20))
+if (chunk_size > 3 * (1 << 20))
 return AVERROR_INVALIDDATA;
+wsvqa->vqfl_chunk_size = chunk_size;
 /* We need a big seekback buffer because there can be SNxx, VIEW 
and ZBUF
  * chunks (<512 KiB total) in the stream before we read VQFR (<256 
KiB) and
  * seek back here. */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/sbgdec: Check for period overflow

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 21:18:14 2023 +0200| [f43562c38a78a6736e5abf2338db731aff8ea9ce] | 
committer: Michael Niedermayer

avformat/sbgdec: Check for period overflow

Fixes: signed integer overflow: 448124699617300 - -47785768200 
cannot be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5063670588899328

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a9137110eda130ba07a2a43bdedff2421efbb7a9)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f43562c38a78a6736e5abf2338db731aff8ea9ce
---

 libavformat/sbgdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index 5edb9664cc..9f1d399361 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -1289,7 +1289,10 @@ static int generate_intervals(void *log, struct 
sbg_script *s, int sample_rate,
 /* SBaGen handles the time before and after the extremal events,
and the corresponding transitions, as if the sequence were cyclic
with a 24-hours period. */
-period = s->events[s->nb_events - 1].ts - s->events[0].ts;
+period = s->events[s->nb_events - 1].ts - (uint64_t)s->events[0].ts;
+if (period < 0)
+return AVERROR_INVALIDDATA;
+
 period = (period + (DAY_TS - 1)) / DAY_TS * DAY_TS;
 period = FFMAX(period, DAY_TS);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/concatdec: Check in/outpoint for overflow

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Sep 30 19:11:34 2023 +0200| [d4910533348155f66a202e4263a08f9ea0ea89f8] | 
committer: Michael Niedermayer

avformat/concatdec: Check in/outpoint for overflow

Fixes: signed integer overflow: 9154241445400 - -915424149454600 cannot 
be represented in type 'long'
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-4739147999084544

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit dedc78b4b5bdab869f3038798334639d617d2309)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4910533348155f66a202e4263a08f9ea0ea89f8
---

 libavformat/concatdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index e57da59e04..806b570cdf 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -665,7 +665,9 @@ static int concat_read_header(AVFormatContext *avf)
 else
 time = cat->files[i].start_time;
 if (cat->files[i].user_duration == AV_NOPTS_VALUE) {
-if (cat->files[i].inpoint == AV_NOPTS_VALUE || 
cat->files[i].outpoint == AV_NOPTS_VALUE)
+if (cat->files[i].inpoint == AV_NOPTS_VALUE || 
cat->files[i].outpoint == AV_NOPTS_VALUE ||
+cat->files[i].outpoint - (uint64_t)cat->files[i].inpoint != 
av_sat_sub64(cat->files[i].outpoint, cat->files[i].inpoint)
+)
 break;
 cat->files[i].user_duration = cat->files[i].outpoint - 
cat->files[i].inpoint;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/mxfdec: Remove this_partition

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Fri Sep 22 21:13:44 2023 +0200| [b358b080a146602e87db28526d0ec3e629af3b8e] | 
committer: Michael Niedermayer

avformat/mxfdec: Remove this_partition

Suggested-by: Tomas Härdin 
Fixes: 
51896/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5130394286817280

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 442d9412d21590c7a816118032c92070e00a1cc1)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b358b080a146602e87db28526d0ec3e629af3b8e
---

 libavformat/mxfdec.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index f6d79a3551..2b2cfba273 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -99,7 +99,6 @@ typedef struct MXFPartition {
 uint64_t previous_partition;
 int index_sid;
 int body_sid;
-int64_t this_partition;
 int64_t essence_offset; ///< absolute offset of essence
 int64_t essence_length;
 int32_t kag_size;
@@ -714,10 +713,13 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 UID op;
 uint64_t footer_partition;
 uint32_t nb_essence_containers;
+uint64_t this_partition;
 
 if (mxf->partitions_count >= INT_MAX / 2)
 return AVERROR_INVALIDDATA;
 
+av_assert0(klv_offset >= mxf->run_in);
+
 tmp_part = av_realloc_array(mxf->partitions, mxf->partitions_count + 1, 
sizeof(*mxf->partitions));
 if (!tmp_part)
 return AVERROR(ENOMEM);
@@ -760,7 +762,13 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 partition->complete = uid[14] > 2;
 avio_skip(pb, 4);
 partition->kag_size = avio_rb32(pb);
-partition->this_partition = avio_rb64(pb);
+this_partition = avio_rb64(pb);
+if (this_partition != klv_offset - mxf->run_in) {
+av_log(mxf->fc, AV_LOG_ERROR,
+   "this_partition %"PRId64" mismatches %"PRId64"\n",
+   this_partition, klv_offset - mxf->run_in);
+return AVERROR_INVALIDDATA;
+}
 partition->previous_partition = avio_rb64(pb);
 footer_partition = avio_rb64(pb);
 partition->header_byte_count = avio_rb64(pb);
@@ -780,8 +788,8 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 av_dict_set(>metadata, "operational_pattern_ul", str, 0);
 }
 
-if (partition->this_partition &&
-partition->previous_partition == partition->this_partition) {
+if (this_partition &&
+partition->previous_partition == this_partition) {
 av_log(mxf->fc, AV_LOG_ERROR,
"PreviousPartition equal to ThisPartition %"PRIx64"\n",
partition->previous_partition);
@@ -789,11 +797,11 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 if (!mxf->parsing_backward && mxf->last_forward_partition > 1) {
 MXFPartition *prev =
 mxf->partitions + mxf->last_forward_partition - 2;
-partition->previous_partition = prev->this_partition;
+partition->previous_partition = prev->pack_ofs - mxf->run_in;
 }
 /* if no previous body partition are found point to the header
  * partition */
-if (partition->previous_partition == partition->this_partition)
+if (partition->previous_partition == this_partition)
 partition->previous_partition = 0;
 av_log(mxf->fc, AV_LOG_ERROR,
"Overriding PreviousPartition with %"PRIx64"\n",
@@ -815,7 +823,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext 
*pb, int tag, int size
 "PartitionPack: ThisPartition = 0x%"PRIX64
 ", PreviousPartition = 0x%"PRIX64", "
 "FooterPartition = 0x%"PRIX64", IndexSID = %i, BodySID = %i\n",
-partition->this_partition,
+this_partition,
 partition->previous_partition, footer_partition,
 partition->index_sid, partition->body_sid);
 
@@ -889,7 +897,7 @@ static uint64_t partition_score(MXFPartition *p)
 score = 3;
 else
 score = 1;
-return (score << 60) | ((uint64_t)p->this_partition >> 4);
+return (score << 60) | ((uint64_t)p->pack_ofs >> 4);
 }
 
 static int mxf_add_metadata_set(MXFContext *mxf, MXFMetadataSet **metadata_set)
@@ -3446,14 +3454,14 @@ static void 
mxf_compute_essence_containers(AVFormatContext *s)
 
 /* essence container spans to the next partition */
 if (x < mxf->partitions_count - 1)
-p->essence_length = mxf->partitions[x+1].this_partition - 
p->essence_offset;
+p->essence_length = mxf->partitions[x+1].pack_ofs - 
mxf->run_in - p->essence_offset;
 
 if (p->essence_length < 0) {
 /* next ThisPartition < essence_offset */
 p->essence_length = 0;
   

[FFmpeg-cvslog] avcodec/xvididct: Fix integer overflow in idct_row()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Fri Sep  8 00:13:11 2023 +0200| [d5f1ecbe247d3d75ea0474556bffab017c9054d6] | 
committer: Michael Niedermayer

avcodec/xvididct: Fix integer overflow in idct_row()

Fixes: signed integer overflow: 1871429831 + 343006811 cannot be represented in 
type 'int'
Fixes: 
61784/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AIC_fuzzer-5372151001120768

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b12444fe72173ab52b6479708cfd12cb889ca300)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5f1ecbe247d3d75ea0474556bffab017c9054d6
---

 libavcodec/xvididct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index 43ea927437..dcea32210a 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -114,7 +114,7 @@ static int idct_row(short *in, const int *const tab, int 
rnd)
 in[5] = a1;
 in[6] = a1;
 } else {
-const int k  = c4 * in[0] + rnd;
+const unsigned int k  = c4 * in[0] + rnd;
 const unsigned int a0 = k + c2 * in[2] + c4 * in[4] + c6 * in[6];
 const unsigned int a1 = k + c6 * in[2] - c4 * in[4] - c2 * in[6];
 const unsigned int a2 = k - c6 * in[2] - c4 * in[4] + c2 * in[6];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/celp_math: avoid overflow in shift

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Sep  7 02:13:13 2023 +0200| [0224effb524c02ab376a887868f543a421318d20] | 
committer: Michael Niedermayer

avcodec/celp_math: avoid overflow in shift

by making gain unsigned we have 1 bit more available
alternatively we can clip twice as in the g729 reference

Fixes: left shift of 23404 by 17 places cannot be represented in type 'int'
Fixes: 
61728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6280412547383296

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6580a7b2b27973947118482235a2eb1214d968a2)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0224effb524c02ab376a887868f543a421318d20
---

 libavcodec/celp_math.h  | 2 +-
 libavcodec/g729postfilter.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/celp_math.h b/libavcodec/celp_math.h
index 1a425d..99a0470719 100644
--- a/libavcodec/celp_math.h
+++ b/libavcodec/celp_math.h
@@ -78,7 +78,7 @@ int64_t ff_dot_product(const int16_t *a, const int16_t *b, 
int length);
  *
  * @return value << offset, if offset>=0; value >> -offset - otherwise
  */
-static inline int bidir_sal(int value, int offset)
+static inline unsigned bidir_sal(unsigned value, int offset)
 {
 if(offset < 0) return value >> -offset;
 else   return value <<  offset;
diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index 26e937f0ba..382db92432 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -581,7 +581,7 @@ void ff_g729_postfilter(AudioDSPContext *adsp, int16_t* 
ht_prev_data, int* voici
 int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t 
*speech,
int subframe_size, int16_t gain_prev)
 {
-int gain; // (3.12)
+unsigned gain; // (3.12)
 int n;
 int exp_before, exp_after;
 
@@ -603,7 +603,7 @@ int16_t ff_g729_adaptive_gain_control(int gain_before, int 
gain_after, int16_t *
 gain = ((gain_before - gain_after) << 14) / gain_after + 0x4000;
 gain = bidir_sal(gain, exp_after - exp_before);
 }
-gain = av_clip_int16(gain);
+gain = FFMIN(gain, 32767);
 gain = (gain * G729_AGC_FAC1 + 0x4000) >> 15; // gain * (1-0.9875)
 } else
 gain = 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] tools/target_dec_fuzzer: Adjust threshold for rtv1

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed Jul 26 22:33:40 2023 +0200| [7be649290e9c38cc956925b6fb54beb47fdfab99] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust threshold for rtv1

Fixes: 
60499/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RTV1_fuzzer-5020295866744832
Fixes: Timeout

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 9ee87245c5e6eae017430726cce9b4c20d468c2d)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7be649290e9c38cc956925b6fb54beb47fdfab99
---

 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index c057500dad..e03c1ecbec 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -262,6 +262,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_PAF_VIDEO:   maxpixels  /= 16;break;
 case AV_CODEC_ID_PRORES:  maxpixels  /= 256;   break;
 case AV_CODEC_ID_RASC:maxpixels  /= 16;break;
+case AV_CODEC_ID_RTV1:maxpixels  /= 16;break;
 case AV_CODEC_ID_SANM:maxpixels  /= 16;break;
 case AV_CODEC_ID_SCPR:maxpixels  /= 32;break;
 case AV_CODEC_ID_SCREENPRESSO:maxpixels  /= 64;break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/jpeg2000dec: jpeg2000 has its own lowres option

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Jun 10 01:11:48 2023 +0200| [3c56b5c3df4d3315d7ac5d02e9baefc6c9f0a6ad] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: jpeg2000 has its own lowres option

jpeg2000 overrides the global lowres variable with a lowres field called 
reduction_factor
ffmpeg -lowres X causes the reduction_factor to be set
ffplay -lowres X causes both lowres and the reduction_factor to be set
ossfuss sets only lowres

only the ffmpeg variant works. This patch tries to make the other 2 work.

Alternative we could just error out if things are inconsistent.
More complex restructuring should be limited to the master branch
to keep this reasonably easy to backport

Fixes: out of array access
Fixes: 59672/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit c012d1f2bb8735f2b17ce88cd8181d2ffc989b02)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c56b5c3df4d3315d7ac5d02e9baefc6c9f0a6ad
---

 libavcodec/jpeg2000dec.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 69503059d7..fc10bb8f0c 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -393,7 +393,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
 dimy = FFMAX(dimy, ff_jpeg2000_ceildiv(o_dimy, s->cdy[i]));
 }
 
-ret = ff_set_dimensions(s->avctx, dimx, dimy);
+ret = ff_set_dimensions(s->avctx, dimx << s->avctx->lowres, dimy << 
s->avctx->lowres);
 if (ret < 0)
 return ret;
 
@@ -2472,6 +2472,14 @@ static av_cold int jpeg2000_decode_init(AVCodecContext 
*avctx)
 {
 Jpeg2000DecoderContext *s = avctx->priv_data;
 
+if (avctx->lowres)
+av_log(avctx, AV_LOG_WARNING, "lowres is overriden by reduction_factor 
but set anyway\n");
+if (!s->reduction_factor && avctx->lowres < JPEG2000_MAX_RESLEVELS) {
+s->reduction_factor = avctx->lowres;
+}
+if (avctx->lowres != s->reduction_factor && avctx->lowres)
+return AVERROR(EINVAL);
+
 ff_jpeg2000dsp_init(>dsp);
 ff_jpeg2000_init_tier1_luts();
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/hls: reduce default max reload to 3

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Mon May 15 02:05:45 2023 +0200| [6c176df7e9696175e5c1a757c57d7e9d60564c14] | 
committer: Michael Niedermayer

avformat/hls: reduce default max reload to 3

The 1000 did result in the appearance of a never ending reload loop

The RFC mandates that "If the client reloads a Playlist file and finds that it 
has not
changed, then it MUST wait for a period of one-half the target
duration before retrying." and if it has changed
"the client MUST wait for at least the target duration before attempting to 
reload the
Playlist file again"

Trying to reload 3 times seems a better default than 1000 given these
durations

Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5f810435c2a6d985fabd9e6c025e0da0c99c39a9)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c176df7e9696175e5c1a757c57d7e9d60564c14
---

 libavformat/hls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index e622425e80..bf7fdc1553 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2538,7 +2538,7 @@ static const AVOption hls_options[] = {
 {.str = 
"3gp,aac,avi,ac3,eac3,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
 INT_MIN, INT_MAX, FLAGS},
 {"max_reload", "Maximum number of times a insufficient list is attempted 
to be reloaded",
-OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
+OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 3}, 0, INT_MAX, FLAGS},
 {"m3u8_hold_counters", "The maximum number of times to load m3u8 when it 
refreshes without new segments",
 OFFSET(m3u8_hold_counters), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, 
INT_MAX, FLAGS},
 {"http_persistent", "Use persistent HTTP connections",

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue Jun 20 00:13:43 2023 +0200| [55a00e464c4c13a466f97a2d984c09f2cc538505] | 
committer: Michael Niedermayer

avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure

Fixes: left shift of negative value -1
Fixes: 
59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 90647a9249aee8c0ef6c0bced3558ada9643f5b6)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55a00e464c4c13a466f97a2d984c09f2cc538505
---

 libavcodec/huffyuvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 6862376c44..2785da60e7 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -716,7 +716,7 @@ static void decode_plane_bitstream(HYuvContext *s, int 
width, int plane)
 }
 }
 if( width&1 && get_bits_left(>gb)>0 ) {
-int dst = get_vlc2(>gb, s->vlc[plane].table, VLC_BITS, 3)<<2;
+int dst = (unsigned)get_vlc2(>gb, s->vlc[plane].table, 
VLC_BITS, 3)<<2;
 s->temp16[0][width-1] = dst + get_bits(>gb, 2);
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/format: Stop reading data at EOF during probing

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed May 10 23:58:31 2023 +0200| [ee90868c67782fb0a79d51376aa05b045f6805f8] | 
committer: Michael Niedermayer

avformat/format: Stop reading data at EOF during probing

Issue found by: Сергей Колесников
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 80f6e0378beae69d31f24b036a1365405dea61d1)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee90868c67782fb0a79d51376aa05b045f6805f8
---

 libavformat/format.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/format.c b/libavformat/format.c
index 4b1f3c2986..4fb62eaffb 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -233,6 +233,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const 
AVInputFormat **fmt,
 int ret = 0, probe_size, buf_offset = 0;
 int score = 0;
 int ret2;
+int eof = 0;
 
 if (!max_probe_size)
 max_probe_size = PROBE_BUF_MAX;
@@ -256,7 +257,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const 
AVInputFormat **fmt,
 }
 }
 
-for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt;
+for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt && 
!eof;
  probe_size = FFMIN(probe_size << 1,
 FFMAX(max_probe_size, probe_size + 1))) {
 score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0;
@@ -272,6 +273,7 @@ int av_probe_input_buffer2(AVIOContext *pb, const 
AVInputFormat **fmt,
 
 score = 0;
 ret   = 0;  /* error was end of file, nothing read */
+eof   = 1;
 }
 buf_offset += ret;
 if (buf_offset < offset)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Sep 10 16:27:02 2023 +0200| [82f7adf45dde3f7790eb7591bf312111baa5a61f] | 
committer: Michael Niedermayer

avcodec/cscd: Fix "CamStudio Lossless Codec 1.0" gzip files

Fixes: tickets/10241/cscd_1_0_306_306_gzip.avi

Signed-off-by: Michael Niedermayer 
(cherry picked from commit ab7d38f970674e6765b5e1adb911c1763b9ce806)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82f7adf45dde3f7790eb7591bf312111baa5a61f
---

 libavcodec/cscd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index e1ebe04253..b0d888d9b0 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -72,6 +72,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 int buf_size = avpkt->size;
 CamStudioContext *c = avctx->priv_data;
 int ret;
+int bpp = avctx->bits_per_coded_sample / 8;
+int bugdelta = FFALIGN(avctx->width * bpp, 4)   * avctx->height
+ -(avctx->width & ~3) * bpp * avctx->height;
 
 if (buf_size < 2) {
 av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
@@ -85,9 +88,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 switch ((buf[0] >> 1) & 7) {
 case 0: { // lzo compression
 int outlen = c->decomp_size, inlen = buf_size - 2;
-int bpp = avctx->bits_per_coded_sample / 8;
-int bugdelta = FFALIGN(avctx->width * bpp, 4)   * avctx->height
- -(avctx->width & ~3) * bpp * avctx->height;
 if (av_lzo1x_decode(c->decomp_buf, , [2], ) || 
(outlen && outlen != bugdelta)) {
 av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
 return AVERROR_INVALIDDATA;
@@ -97,7 +97,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 case 1: { // zlib compression
 #if CONFIG_ZLIB
 unsigned long dlen = c->decomp_size;
-if (uncompress(c->decomp_buf, , [2], buf_size - 2) != Z_OK || 
dlen != c->decomp_size) {
+if (uncompress(c->decomp_buf, , [2], buf_size - 2) != Z_OK || 
(dlen != c->decomp_size && dlen != c->decomp_size - bugdelta)) {
 av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of LZO files

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Wed Mar  8 22:11:59 2023 +0100| [fccc3130c74ec01949b22726dced55cf8594121f] | 
committer: Michael Niedermayer

avcodec/cscd: Check for CamStudio Lossless Codec 1.0 behavior in end check of 
LZO files

Alternatively the check could be simply made more tolerant
Fixes: Ticket10227

Signed-off-by: Michael Niedermayer 
(cherry picked from commit d2a0464fc2dd6f79571a66e6c7a8168323168e46)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fccc3130c74ec01949b22726dced55cf8594121f
---

 libavcodec/cscd.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index ea84711299..e1ebe04253 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -85,7 +85,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*rframe,
 switch ((buf[0] >> 1) & 7) {
 case 0: { // lzo compression
 int outlen = c->decomp_size, inlen = buf_size - 2;
-if (av_lzo1x_decode(c->decomp_buf, , [2], ) || 
outlen) {
+int bpp = avctx->bits_per_coded_sample / 8;
+int bugdelta = FFALIGN(avctx->width * bpp, 4)   * avctx->height
+ -(avctx->width & ~3) * bpp * avctx->height;
+if (av_lzo1x_decode(c->decomp_buf, , [2], ) || 
(outlen && outlen != bugdelta)) {
 av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mpeg4videodec: consider lowres in dest_pcm[]

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jul 23 19:01:37 2023 +0200| [10dfb498ea42974e6523f2862775886045db9b48] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: consider lowres in dest_pcm[]

Fixes: out of array access
Fixes: 
5/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5767982157266944

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit d48476183fad230c8e457b2f314f8e136b973c4e)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10dfb498ea42974e6523f2862775886045db9b48
---

 libavcodec/mpeg4videodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index b04ec1388e..46c6f9026b 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -123,7 +123,7 @@ void ff_mpeg4_decode_studio(MpegEncContext *s, uint8_t 
*dest_y, uint8_t *dest_cb
 int hsub = i ? s->chroma_x_shift : 0;
 int lowres = s->avctx->lowres;
 int step = 1 << lowres;
-dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub) - 1);
+dest_pcm[i] += (linesize[i] / 2) * ((16 >> vsub + lowres) - 1);
 for (int h = (16 >> (vsub + lowres)) - 1; h >= 0; h--){
 for (int w = (16 >> (hsub + lowres)) - 1, idx = 0; w >= 0; 
w--, idx += step)
 dest_pcm[i][w] = src[idx];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/hevcdec: Fix undefined memcpy()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jul 23 19:45:18 2023 +0200| [54d87e4b283734f1a97cb1b5c7e7d76f4056cdac] | 
committer: Michael Niedermayer

avcodec/hevcdec: Fix undefined memcpy()

There is likely a better way to fix this, this is mainly to show the problem

Fixes: MC within same frame resulting in overlapping memcpy()
Fixes: 
60189/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4992746590175232
Fixes: 
61753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5022150806077440
Fixes: 
58062/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4717458841010176

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 94bd1796ff45b396021cd260e9b037bc61815933)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54d87e4b283734f1a97cb1b5c7e7d76f4056cdac
---

 libavcodec/hevcdec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 492a0e7e68..2e3ee9dc6e 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1517,7 +1517,8 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, 
ptrdiff_t dststride,
 
 if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER ||
 x_off >= pic_width - block_w - QPEL_EXTRA_AFTER ||
-y_off >= pic_height - block_h - QPEL_EXTRA_AFTER) {
+y_off >= pic_height - block_h - QPEL_EXTRA_AFTER ||
+ref == s->frame) {
 const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << 
s->ps.sps->pixel_shift;
 int offset = QPEL_EXTRA_BEFORE * srcstride   + 
(QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
 int buf_offset = QPEL_EXTRA_BEFORE * edge_emu_stride + 
(QPEL_EXTRA_BEFORE << s->ps.sps->pixel_shift);
@@ -1665,6 +1666,7 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0,
 intptr_t my  = av_mod_uintp2(mv->y, 2 + vshift);
 intptr_t _mx = mx << (1 - hshift);
 intptr_t _my = my << (1 - vshift);
+int emu  = src0 == s->frame->data[1] || src0 == 
s->frame->data[2];
 
 x_off += mv->x >> (2 + hshift);
 y_off += mv->y >> (2 + vshift);
@@ -1672,7 +1674,8 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0,
 
 if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
 x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||
-y_off >= pic_height - block_h - EPEL_EXTRA_AFTER) {
+y_off >= pic_height - block_h - EPEL_EXTRA_AFTER ||
+emu) {
 const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << 
s->ps.sps->pixel_shift;
 int offset0 = EPEL_EXTRA_BEFORE * (srcstride + (1 << 
s->ps.sps->pixel_shift));
 int buf_offset0 = EPEL_EXTRA_BEFORE *

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/mpeg4videodec: more unsigned in amv computation

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Jun  1 23:35:10 2023 +0200| [06ff2bfe0f29ae6fa817ea6457cd775e88780e48] | 
committer: Michael Niedermayer

avcodec/mpeg4videodec: more unsigned in amv computation

Fixes: signed integer overflow: -2147483648 + -1048576 cannot be represented in 
type 'int'
Fixes: 
59365/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-642654923954585

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0adaa90d89114dc86dbc5704ce31ded5b6750d13)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06ff2bfe0f29ae6fa817ea6457cd775e88780e48
---

 libavcodec/mpeg4videodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 724c6aacf3..b04ec1388e 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -685,7 +685,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
 for (y = 0; y < 16; y++) {
 int v;
 
-v = mb_v + dy * y;
+v = mb_v + (unsigned)dy * y;
 // FIXME optimize
 for (x = 0; x < 16; x++) {
 sum += v >> shift;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/tta: fix signed overflow in decorrelate

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Aug  5 14:35:55 2023 +0200| [b91b26813c62e4a6e630dbf98486c0d48dd6f5c6] | 
committer: Michael Niedermayer

avcodec/tta: fix signed overflow in decorrelate

Fixes: signed integer overflow: 2079654542 - -139267653 cannot be represented 
in type 'int'
Fixes: 
60811/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TTA_fuzzer-5915858409750528

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 283bf5c35bc5ac92e061f27c3a680318175a1600)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b91b26813c62e4a6e630dbf98486c0d48dd6f5c6
---

 libavcodec/tta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 0fc639b11c..c23439a2c0 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -341,7 +341,7 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 if (s->channels > 1) {
 int32_t *r = p - 1;
 for (*p += *r / 2; r > (int32_t*)p - s->channels; r--)
-*r = *(r + 1) - *r;
+*r = *(r + 1) - (unsigned)*r;
 }
 cur_chan = 0;
 i++;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/apedec: Fix 48khz 24bit below insane level

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Fri Aug 25 16:59:15 2023 +0200| [e61e0ea8c6a57327669737fd4ffe0164fde2f06b] | 
committer: Michael Niedermayer

avcodec/apedec: Fix 48khz 24bit below insane level

Fixes: Ticket9816
Fixes: vlc.ape and APE_48K_24bit_2CH_02_01.ape

Regression since: ed0001482a74b60f3d5bc5cd7e304c9d65b2fcd5.

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 80ad0e2198df4e2961928d8304da58df6db77ec4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e61e0ea8c6a57327669737fd4ffe0164fde2f06b
---

 libavcodec/apedec.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 81953df221..8aca605343 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1170,7 +1170,8 @@ static void predictor_decode_mono_3930(APEContext *ctx, 
int count)
 static av_always_inline int predictor_update_filter(APEPredictor64 *p,
 const int decoded, const 
int filter,
 const int delayA,  const 
int delayB,
-const int adaptA,  const 
int adaptB)
+const int adaptA,  const 
int adaptB,
+int compression_level)
 {
 int64_t predictionA, predictionB;
 int32_t sign;
@@ -1198,7 +1199,13 @@ static av_always_inline int 
predictor_update_filter(APEPredictor64 *p,
   p->buf[delayB - 3] * p->coeffsB[filter][3] +
   p->buf[delayB - 4] * p->coeffsB[filter][4];
 
-p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + 
(predictionB >> 1)) >> 10);
+if (compression_level < COMPRESSION_LEVEL_INSANE) {
+predictionA = (int32_t)predictionA;
+predictionB = (int32_t)predictionB;
+p->lastA[filter] = decoded + ((int32_t)(predictionA + (predictionB >> 
1)) >> 10);
+} else {
+p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + 
(predictionB >> 1)) >> 10);
+}
 p->filterA[filter] = p->lastA[filter] + ((int64_t)(p->filterA[filter] * 
31ULL) >> 5);
 
 sign = APESIGN(decoded);
@@ -1226,10 +1233,12 @@ static void predictor_decode_stereo_3950(APEContext 
*ctx, int count)
 while (count--) {
 /* Predictor Y */
 *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,
-YADAPTCOEFFSA, YADAPTCOEFFSB);
+YADAPTCOEFFSA, YADAPTCOEFFSB,
+ctx->compression_level);
 decoded0++;
 *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,
-XADAPTCOEFFSA, XADAPTCOEFFSB);
+XADAPTCOEFFSA, XADAPTCOEFFSB,
+ctx->compression_level);
 decoded1++;
 
 /* Combined */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/apedec: Fix CRC for 24bps and bigendian

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Fri Aug 25 00:24:21 2023 +0200| [d548c94bfaf9d4c388be4ffd8be27be29de1c18e] | 
committer: Michael Niedermayer

avcodec/apedec: Fix CRC for 24bps and bigendian

Fixes CRC for vlc.ape and APE_48K_24bit_2CH_02_01.ape

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 696e161919f18f13be0f82f41715b445d31022d7)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d548c94bfaf9d4c388be4ffd8be27be29de1c18e
---

 libavcodec/apedec.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 24877c5598..81953df221 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1612,13 +1612,24 @@ static int ape_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 s->samples -= blockstodecode;
 
 if (avctx->err_recognition & AV_EF_CRCCHECK &&
-s->fileversion >= 3900 && s->bps < 24) {
+s->fileversion >= 3900) {
 uint32_t crc = s->CRC_state;
 const AVCRC *crc_tab = av_crc_get_table(AV_CRC_32_IEEE_LE);
+int stride = s->bps == 24 ? 4 : (s->bps>>3);
+int offset = s->bps == 24;
+int bytes  = s->bps >> 3;
+
 for (i = 0; i < blockstodecode; i++) {
 for (ch = 0; ch < s->channels; ch++) {
-uint8_t *smp = frame->data[ch] + (i*(s->bps >> 3));
-crc = av_crc(crc_tab, crc, smp, s->bps >> 3);
+#if HAVE_BIGENDIAN
+uint8_t *smp_native = frame->data[ch] + i*stride;
+uint8_t smp[4];
+for(int j = 0; jdata[ch] + i*stride;
+#endif
+crc = av_crc(crc_tab, crc, smp+offset, bytes);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/avr: Check sample rate

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jul 23 01:46:20 2023 +0200| [cfa3ae4181567dcc711828ad59ab3000d718e37f] | 
committer: Michael Niedermayer

avformat/avr: Check sample rate

Fixes: 
54979/clusterfuzz-testcase-minimized-ffmpeg_dem_AVR_fuzzer-6681035461230592
Fixes: Timeout

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 32556fa62b1d0615f621fd8f71bdfe3b72e43896)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfa3ae4181567dcc711828ad59ab3000d718e37f
---

 libavformat/avr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/avr.c b/libavformat/avr.c
index 1cc4d56bfb..dce977b6ac 100644
--- a/libavformat/avr.c
+++ b/libavformat/avr.c
@@ -70,6 +70,9 @@ static int avr_read_header(AVFormatContext *s)
 avio_skip(s->pb, 1); // replay speed
 
 st->codecpar->sample_rate = avio_rb24(s->pb);
+if (st->codecpar->sample_rate == 0)
+return AVERROR_INVALIDDATA;
+
 avio_skip(s->pb, 4 * 3);
 avio_skip(s->pb, 2 * 3);
 avio_skip(s->pb, 20);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/xvididct: Fix integer overflow in idct_row()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Mon Aug  7 00:02:21 2023 +0200| [7c646d22cf269964858c695b8fbfce5b5ad90ac8] | 
committer: Michael Niedermayer

avcodec/xvididct: Fix integer overflow in idct_row()

Fixes: signed integer overflow: -1403461578 + -843974775 cannot be represented 
in type 'int'
Fixes: 
60868/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-4599793035378688

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0ce322a51eae87fd3a0eb96f2280175554ef30c5)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c646d22cf269964858c695b8fbfce5b5ad90ac8
---

 libavcodec/xvididct.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/xvididct.c b/libavcodec/xvididct.c
index f338901ab2..43ea927437 100644
--- a/libavcodec/xvididct.c
+++ b/libavcodec/xvididct.c
@@ -69,24 +69,24 @@ static int idct_row(short *in, const int *const tab, int 
rnd)
 if (!(right | in[4])) {
 const int k = c4 * in[0] + rnd;
 if (left) {
-const int a0 = k + c2 * in[2];
-const int a1 = k + c6 * in[2];
-const int a2 = k - c6 * in[2];
-const int a3 = k - c2 * in[2];
+const unsigned a0 = k + c2 * in[2];
+const unsigned a1 = k + c6 * in[2];
+const unsigned a2 = k - c6 * in[2];
+const unsigned a3 = k - c2 * in[2];
 
 const int b0 = c1 * in[1] + c3 * in[3];
 const int b1 = c3 * in[1] - c7 * in[3];
 const int b2 = c5 * in[1] - c1 * in[3];
 const int b3 = c7 * in[1] - c5 * in[3];
 
-in[0] = (a0 + b0) >> ROW_SHIFT;
-in[1] = (a1 + b1) >> ROW_SHIFT;
-in[2] = (a2 + b2) >> ROW_SHIFT;
-in[3] = (a3 + b3) >> ROW_SHIFT;
-in[4] = (a3 - b3) >> ROW_SHIFT;
-in[5] = (a2 - b2) >> ROW_SHIFT;
-in[6] = (a1 - b1) >> ROW_SHIFT;
-in[7] = (a0 - b0) >> ROW_SHIFT;
+in[0] = (int)(a0 + b0) >> ROW_SHIFT;
+in[1] = (int)(a1 + b1) >> ROW_SHIFT;
+in[2] = (int)(a2 + b2) >> ROW_SHIFT;
+in[3] = (int)(a3 + b3) >> ROW_SHIFT;
+in[4] = (int)(a3 - b3) >> ROW_SHIFT;
+in[5] = (int)(a2 - b2) >> ROW_SHIFT;
+in[6] = (int)(a1 - b1) >> ROW_SHIFT;
+in[7] = (int)(a0 - b0) >> ROW_SHIFT;
 } else {
 const int a0 = k >> ROW_SHIFT;
 if (a0) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/softfloat: fix av_sincos_sf()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue Jun 20 00:59:40 2023 +0200| [706c44541ed6da16d352a55f3f80d9f48ca3c883] | 
committer: Michael Niedermayer

avutil/softfloat: fix av_sincos_sf()

Signed-off-by: Michael Niedermayer 
(cherry picked from commit d84677abd8ffb8ca8ad94eced6d9e03928f35d79)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=706c44541ed6da16d352a55f3f80d9f48ca3c883
---

 libavutil/softfloat.h   | 2 +-
 libavutil/tests/softfloat.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index a651406f74..1520027ddc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -281,7 +281,7 @@ static av_unused void av_sincos_sf(int a, int *s, int *c)
 (int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) +
 0x400) >> 11);
 
-*c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x2000) >> 30);
+*c = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x2000) >> 30);
 
 *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x2000) >> 30);
 }
diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c
index c06de44933..a2e628fe81 100644
--- a/libavutil/tests/softfloat.c
+++ b/libavutil/tests/softfloat.c
@@ -148,7 +148,7 @@ int main(void){
 av_sincos_sf(i*(1ULL<<32)/36/4, , );
 errs = (double)s/ (1<<30) - sin(i*M_PI/36);
 errc = (double)c/ (1<<30) - cos(i*M_PI/36);
-if (fabs(errs) > 0.0002 || fabs(errc) >0.001) {
+if (fabs(errs) > 0.4 || fabs(errc) >0.4) {
 printf("sincos FAIL %d %f %f %f %f\n", i, (float)s/ (1<<30), 
(float)c/ (1<<30), sin(i*M_PI/36), cos(i*M_PI/36));
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/imf_cpl: Replace NULL content_title_utf8 by ""

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jul 23 23:30:14 2023 +0200| [9b5a8aa16d996f5c3d63a14401efcf7f44b718af] | 
committer: Michael Niedermayer

avformat/imf_cpl: Replace NULL content_title_utf8 by ""

Suggested-by: Pierre-Anthony Lemieux 
Reviewed-by: Pierre-Anthony Lemieux 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit ac3e6b74bdd6959ce4411e78161b2f06d0926c43)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b5a8aa16d996f5c3d63a14401efcf7f44b718af
---

 libavformat/imf_cpl.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index a688a44711..3328a3ed18 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -177,6 +177,10 @@ static int fill_content_title(xmlNodePtr cpl_element, 
FFIMFCPL *cpl)
 cpl->content_title_utf8 = xmlNodeListGetString(cpl_element->doc,
element->xmlChildrenNode,
1);
+if (!cpl->content_title_utf8)
+cpl->content_title_utf8 = xmlStrdup("");
+if (!cpl->content_title_utf8)
+return AVERROR(ENOMEM);
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/imf_cpl: xmlNodeListGetString() can return NULL

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jul 23 20:03:01 2023 +0200| [c09250be43d823621646ba9e984f478a028c2b2f] | 
committer: Michael Niedermayer

avformat/imf_cpl: xmlNodeListGetString() can return NULL

Fixes: NULL pointer dereference
Fixes: 
60166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5998301577871360

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Pierre-Anthony Lemieux 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 509ce40f188734ec74078ebdd8d71f80116d9eaf)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c09250be43d823621646ba9e984f478a028c2b2f
---

 libavformat/imf_cpl.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index f2c6b6f064..a688a44711 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -76,6 +76,8 @@ int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid)
 int ret = 0;
 
 element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
+if (!element_text)
+return AVERROR_INVALIDDATA;
 ret = av_uuid_urn_parse(element_text, uuid);
 if (ret) {
 av_log(NULL, AV_LOG_ERROR, "Invalid UUID\n");
@@ -92,7 +94,7 @@ int ff_imf_xml_read_rational(xmlNodePtr element, AVRational 
*rational)
 int ret = 0;
 
 element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
-if (sscanf(element_text, "%i %i", >num, >den) != 2) {
+if (element_text == NULL || sscanf(element_text, "%i %i", >num, 
>den) != 2) {
 av_log(NULL, AV_LOG_ERROR, "Invalid rational number\n");
 ret = AVERROR_INVALIDDATA;
 }
@@ -107,7 +109,7 @@ int ff_imf_xml_read_uint32(xmlNodePtr element, uint32_t 
*number)
 int ret = 0;
 
 element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
-if (sscanf(element_text, "%" PRIu32, number) != 1) {
+if (element_text == NULL || sscanf(element_text, "%" PRIu32, number) != 1) 
{
 av_log(NULL, AV_LOG_ERROR, "Invalid unsigned 32-bit integer");
 ret = AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jun 18 21:00:03 2023 +0200| [515c7b21f47df97944969347b28dcba640748de6] | 
committer: Michael Niedermayer

avcodec/utils: fix 2 integer overflows in get_audio_frame_duration()

Fixes: signed integer overflow: 256 * 668003712 cannot be represented in type 
'int'
Fixes: 
59819/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-4674636538052608

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a4bf559683a999c8faa408fdd8f29bd28a6a47ea)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=515c7b21f47df97944969347b28dcba640748de6
---

 libavcodec/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index add1e2139b..a0c5eb4808 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -649,9 +649,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int 
sr, int ch, int ba,
 if (sr > 0) {
 /* calc from sample rate */
 if (id == AV_CODEC_ID_TTA)
-return 256 * sr / 245;
+return 256ll * sr / 245;
 else if (id == AV_CODEC_ID_DST)
-return 588 * sr / 44100;
+return 588ll * sr / 44100;
 else if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
 if (sr / 22050 > 22)
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/pcm: allow Changing parameters

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Mon Jun  5 15:56:58 2023 +0200| [1759fd0d82c460ba95c694a9c4f5a60997d154c3] | 
committer: Michael Niedermayer

avcodec/pcm: allow Changing parameters

SDR needs this for switching between mono and stereo stations

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 94d44dbe212b3ecb67256c4edfc3d7c3c3ac4472)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1759fd0d82c460ba95c694a9c4f5a60997d154c3
---

 libavcodec/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 471075ad71..eb601c4af2 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -584,7 +584,7 @@ const FFCodec ff_ ## name_ ## _decoder = {  
\
 .priv_data_size = sizeof(PCMDecode),\
 .init   = pcm_decode_init,  \
 FF_CODEC_DECODE_CB(pcm_decode_frame),\
-.p.capabilities = AV_CODEC_CAP_DR1, \
+.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_PARAM_CHANGE, \
 .p.sample_fmts  = (const enum AVSampleFormat[]){ sample_fmt_,   \
  AV_SAMPLE_FMT_NONE },  \
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/jpeg2000dec: Check for reduction factor and image offset

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Jun 10 01:09:52 2023 +0200| [fc94130cd6f38c44cd4f72f8f848fd9e7051f8ae] | 
committer: Michael Niedermayer

avcodec/jpeg2000dec: Check for reduction factor and image offset

This combination is not working (it writes out of array)

Reviewed-by: Tomas Härdin 
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 9b6d191a66a8d9b3064efecc79a9f44fb14d7875)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc94130cd6f38c44cd4f72f8f848fd9e7051f8ae
---

 libavcodec/jpeg2000dec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 92966b11f5..69503059d7 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -323,6 +323,11 @@ static int get_siz(Jpeg2000DecoderContext *s)
 return AVERROR_INVALIDDATA;
 }
 
+if (s->reduction_factor && (s->image_offset_x || s->image_offset_y) ){
+av_log(s->avctx, AV_LOG_ERROR, "reduction factor with image offsets is 
not fully implemented");
+return AVERROR_PATCHWELCOME;
+}
+
 s->ncomponents = ncomponents;
 
 if (s->tile_width <= 0 || s->tile_height <= 0) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] tools/target_dec_fuzzer: Adjust threshold for speex

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue Jun 20 00:20:40 2023 +0200| [cde6758306e4771114d2f97615f26b29e49758fe] | 
committer: Michael Niedermayer

tools/target_dec_fuzzer: Adjust threshold for speex

Fixes: Timeout
Fixes: 
59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit fe167bae969cf2deac2f5c480fc5c5ac5f8e6267)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cde6758306e4771114d2f97615f26b29e49758fe
---

 tools/target_dec_fuzzer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 017c5cf024..c057500dad 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -266,6 +266,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_SCPR:maxpixels  /= 32;break;
 case AV_CODEC_ID_SCREENPRESSO:maxpixels  /= 64;break;
 case AV_CODEC_ID_SIMBIOSIS_IMX:maxpixels /= 16384; break;
+case AV_CODEC_ID_SPEEX:   maxsamples /= 128;   break;
 case AV_CODEC_ID_SMACKAUDIO:  maxsamples /= 4096;  break;
 case AV_CODEC_ID_SMACKVIDEO:  maxpixels  /= 64;break;
 case AV_CODEC_ID_SNOW:maxpixels  /= 128;   break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/softfloat: Basic documentation for av_sincos_sf()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue Jun 20 01:26:33 2023 +0200| [18bf4e4ff788cf94cc5c65c97d1b366ffe4fb305] | 
committer: Michael Niedermayer

avutil/softfloat: Basic documentation for av_sincos_sf()

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 4aa1a42a91438b7107d2d77db1fc5ca95c27740c)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=18bf4e4ff788cf94cc5c65c97d1b366ffe4fb305
---

 libavutil/softfloat.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 1520027ddc..399ca6d682 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -236,6 +236,10 @@ static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
 
 /**
  * Rounding-to-nearest used.
+ *
+ * @param a angle in units of (1ULL<<30)/M_PI radians
+ * @param s pointer to where   sine in units of (1<<30) is returned
+ * @param c pointer to where cosine in units of (1<<30) is returned
  */
 static av_unused void av_sincos_sf(int a, int *s, int *c)
 {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/hevcdec: Avoid null pointer dereferences in MC

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu May 25 23:40:18 2023 +0200| [9b10b9b8cb4908e2330785ba357a76ed894fbe30] | 
committer: Michael Niedermayer

avcodec/hevcdec: Avoid null pointer dereferences in MC

Fixes: runtime error: pointer index expression with base 0x 
overflowed to 0xfff8
Fixes: 
58440/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5956015530311680

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a0f4d4e65093a4cb627f05d09b19c922e88cfac1)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b10b9b8cb4908e2330785ba357a76ed894fbe30
---

 libavcodec/hevcdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f8f981e838..492a0e7e68 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1911,13 +1911,13 @@ static void hls_prediction_unit(HEVCContext *s, int x0, 
int y0,
 
 if (current_mv.pred_flag & PF_L0) {
 ref0 = refPicList[0].ref[current_mv.ref_idx[0]];
-if (!ref0)
+if (!ref0 || !ref0->frame->data[0])
 return;
 hevc_await_progress(s, ref0, _mv.mv[0], y0, nPbH);
 }
 if (current_mv.pred_flag & PF_L1) {
 ref1 = refPicList[1].ref[current_mv.ref_idx[1]];
-if (!ref1)
+if (!ref1 || !ref1->frame->data[0])
 return;
 hevc_await_progress(s, ref1, _mv.mv[1], y0, nPbH);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/takdsp: Fix integer overflows

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu May 25 23:40:16 2023 +0200| [df4170b2bcadb8ccd9278532b3ba0f089cbae969] | 
committer: Michael Niedermayer

avcodec/takdsp: Fix integer overflows

Fixes: avcodec/takdsp.c:44:23: runtime error: signed integer overflow: -2097158 
- 2147012608 cannot be represented in type 'int'
Fixes: 
58417/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-526891966464

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit ff8a496d41422b694f66684ada97dcf49e167782)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df4170b2bcadb8ccd9278532b3ba0f089cbae969
---

 libavcodec/takdsp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/takdsp.c b/libavcodec/takdsp.c
index 881d7be5f2..b646a063db 100644
--- a/libavcodec/takdsp.c
+++ b/libavcodec/takdsp.c
@@ -28,8 +28,8 @@ static void decorrelate_ls(int32_t *p1, int32_t *p2, int 
length)
 int i;
 
 for (i = 0; i < length; i++) {
-int32_t a = p1[i];
-int32_t b = p2[i];
+uint32_t a = p1[i];
+uint32_t b = p2[i];
 p2[i] = a + b;
 }
 }
@@ -39,8 +39,8 @@ static void decorrelate_sr(int32_t *p1, int32_t *p2, int 
length)
 int i;
 
 for (i = 0; i < length; i++) {
-int32_t a = p1[i];
-int32_t b = p2[i];
+uint32_t a = p1[i];
+uint32_t b = p2[i];
 p1[i] = b - a;
 }
 }
@@ -50,7 +50,7 @@ static void decorrelate_sm(int32_t *p1, int32_t *p2, int 
length)
 int i;
 
 for (i = 0; i < length; i++) {
-int32_t a = p1[i];
+uint32_t a = p1[i];
 int32_t b = p2[i];
 a-= b >> 1;
 p1[i] = a;
@@ -63,7 +63,7 @@ static void decorrelate_sf(int32_t *p1, int32_t *p2, int 
length, int dshift, int
 int i;
 
 for (i = 0; i < length; i++) {
-int32_t a = p1[i];
+uint32_t a = p1[i];
 int32_t b = p2[i];
 b = (unsigned)((int)(dfactor * (unsigned)(b >> dshift) + 128) 
>> 8) << dshift;
 p1[i] = b - a;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec: Ignoring errors is only possible before the input end

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sat Jun  3 21:44:37 2023 +0200| [74d3c9261a66d4ff154ee0b467b23c374a261d49] | 
committer: Michael Niedermayer

avcodec: Ignoring errors is only possible before the input end

Fixes: out of array read
Fixes: Ticket 10308

Signed-off-by: Michael Niedermayer 
(cherry picked from commit fead656a7bf523d448fe8bd39c1f2ea36be98fb9)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74d3c9261a66d4ff154ee0b467b23c374a261d49
---

 libavcodec/h263dec.c   | 2 +-
 libavcodec/mpeg4videodec.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index d411bae220..d5d731e9f1 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -307,7 +307,7 @@ static int decode_slice(MpegEncContext *s)
 ff_er_add_slice(>er, s->resync_mb_x, s->resync_mb_y,
 s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
 
-if (s->avctx->err_recognition & AV_EF_IGNORE_ERR)
+if ((s->avctx->err_recognition & AV_EF_IGNORE_ERR) && 
get_bits_left(>gb) > 0)
 continue;
 return AVERROR_INVALIDDATA;
 }
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 220d415c6f..724c6aacf3 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1259,7 +1259,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
 if (SHOW_UBITS(re, >gb, 1) == 0) {
 av_log(s->avctx, AV_LOG_ERROR,
"1. marker bit missing in 3. 
esc\n");
-if (!(s->avctx->err_recognition & 
AV_EF_IGNORE_ERR))
+if (!(s->avctx->err_recognition & 
AV_EF_IGNORE_ERR) || get_bits_left(>gb) <= 0)
 return AVERROR_INVALIDDATA;
 }
 SKIP_CACHE(re, >gb, 1);
@@ -1270,7 +1270,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
 if (SHOW_UBITS(re, >gb, 1) == 0) {
 av_log(s->avctx, AV_LOG_ERROR,
"2. marker bit missing in 3. 
esc\n");
-if (!(s->avctx->err_recognition & 
AV_EF_IGNORE_ERR))
+if (!(s->avctx->err_recognition & 
AV_EF_IGNORE_ERR) || get_bits_left(>gb) <= 0)
 return AVERROR_INVALIDDATA;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jpegxl_probe: Forward error codes

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Jun  8 10:26:35 2023 -0400| [537600e78506ca4268c860ba5f21dc15d890e5b8] | 
committer: Michael Niedermayer

avformat/jpegxl_probe: Forward error codes

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 09621fd7d93a12974e9664b2aebb8237e5c46f03)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=537600e78506ca4268c860ba5f21dc15d890e5b8
---

 libavformat/jpegxl_probe.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavformat/jpegxl_probe.c b/libavformat/jpegxl_probe.c
index 47c6c54ff4..2d2d128387 100644
--- a/libavformat/jpegxl_probe.c
+++ b/libavformat/jpegxl_probe.c
@@ -261,8 +261,8 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 if (get_bits_long(gb, 16) != FF_JPEGXL_CODESTREAM_SIGNATURE_LE)
 return -1;
 
-if (jpegxl_read_size_header(gb) < 0)
-return -1;
+if ((ret = jpegxl_read_size_header(gb)) < 0)
+return ret;
 
 all_default = get_bits1(gb);
 if (!all_default)
@@ -281,8 +281,9 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 
 /* preview header */
 if (get_bits1(gb)) {
-if (jpegxl_read_preview_header(gb) < 0)
-return -1;
+ret = jpegxl_read_preview_header(gb);
+if (ret < 0)
+return ret;
 }
 
 /* animation header */
@@ -307,8 +308,9 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 if (num_extra_channels > 4)
 return -1;
 for (uint32_t i = 0; i < num_extra_channels; i++) {
-if (jpegxl_read_extra_channel_info(gb) < 0)
-return -1;
+ret = jpegxl_read_extra_channel_info(gb);
+if (ret < 0)
+return ret;
 if (get_bits_left(gb) < 1)
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/oggparsetheora: clip duration within 64bit

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue May  2 01:46:31 2023 +0200| [1892181787dd575bb137935ad28f81f949ac747a] | 
committer: Michael Niedermayer

avformat/oggparsetheora: clip duration within 64bit

Fixes: signed integer overflow: 9079256848778919936 - -288230376151711746 
cannot be represented in type 'long'
Fixes: 
58248/clusterfuzz-testcase-minimized-ffmpeg_dem_OGG_fuzzer-6326851353313280

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit b1c3d81e71f78e4b3b2c2901ac4649cb74aec272)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1892181787dd575bb137935ad28f81f949ac747a
---

 libavformat/oggparsetheora.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index b9184eff7b..85119352c3 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -196,7 +196,7 @@ static int theora_packet(AVFormatContext *s, int idx)
 if(s->streams[idx]->start_time == AV_NOPTS_VALUE && os->lastpts != 
AV_NOPTS_VALUE) {
 s->streams[idx]->start_time = os->lastpts;
 if (s->streams[idx]->duration > 0)
-s->streams[idx]->duration -= s->streams[idx]->start_time;
+s->streams[idx]->duration = 
av_sat_sub64(s->streams[idx]->duration, s->streams[idx]->start_time);
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/wavdec: Check that smv block fits in available space

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Mar  5 00:51:38 2023 +0100| [50e2f8ef33856bfa05b555a05122e1b3039e34ae] | 
committer: Michael Niedermayer

avformat/wavdec: Check that smv block fits in available space

Fixes: OOM
Fixes: 
56271/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5290810045497344

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit a76efafdb9be966ae3ad52b32370dc644dd582bf)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50e2f8ef33856bfa05b555a05122e1b3039e34ae
---

 libavformat/wavdec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index ca61b844b5..7d16b25e54 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -730,6 +730,10 @@ smv_retry:
 goto smv_out;
 }
 size = avio_rl24(s->pb);
+if (size > wav->smv_block_size) {
+ret = AVERROR_EOF;
+goto smv_out;
+}
 ret  = av_get_packet(s->pb, pkt, size);
 if (ret < 0)
 goto smv_out;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jpegxl_probe: check length instead of blindly reading

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Jun  8 10:26:34 2023 -0400| [55de397fe048f5ae2d7ce1f5c630c513f0ff5e05] | 
committer: Michael Niedermayer

avformat/jpegxl_probe: check length instead of blindly reading

Enable the checked bitreader to avoid overread.
Also add a few checks in loops and between blocks so we exit instead of 
continued
execution.
Alternatively we could add manual checks so that no overread can happen. This 
would be
slightly faster but a bit more work and a bit more fragile

Fixes: Out of array accesses
Fixes: 
59640/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-6584117345779712

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 1ec4553e355039ce69abf8e49389fa43f1f55fc5)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55de397fe048f5ae2d7ce1f5c630c513f0ff5e05
---

 libavformat/jpegxl_probe.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavformat/jpegxl_probe.c b/libavformat/jpegxl_probe.c
index 45f464ffaf..47c6c54ff4 100644
--- a/libavformat/jpegxl_probe.c
+++ b/libavformat/jpegxl_probe.c
@@ -21,6 +21,7 @@
 
 #include "jpegxl_probe.h"
 
+#define UNCHECKED_BITSTREAM_READER 0
 #define BITSTREAM_READER_LE
 #include "libavcodec/get_bits.h"
 
@@ -292,6 +293,8 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 skip_bits_long(gb, 1);
 }
 }
+if (get_bits_left(gb) < 1)
+return AVERROR_INVALIDDATA;
 
 if (!all_default) {
 jpegxl_skip_bit_depth(gb);
@@ -306,6 +309,8 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 for (uint32_t i = 0; i < num_extra_channels; i++) {
 if (jpegxl_read_extra_channel_info(gb) < 0)
 return -1;
+if (get_bits_left(gb) < 1)
+return AVERROR_INVALIDDATA;
 }
 
 xyb_encoded = get_bits1(gb);
@@ -335,8 +340,11 @@ int ff_jpegxl_verify_codestream_header(const uint8_t *buf, 
int buflen)
 return -1;
 if (primaries == FF_JPEGXL_PR_CUSTOM) {
 /* ux/uy values for r,g,b */
-for (int i = 0; i < 6; i++)
+for (int i = 0; i < 6; i++) {
 jxl_u32(gb, 0, 524288, 1048576, 2097152, 19, 
19, 20, 21);
+if (get_bits_left(gb) < 1)
+return AVERROR_INVALIDDATA;
+}
 }
 }
 }
@@ -362,10 +370,14 @@ int ff_jpegxl_verify_codestream_header(const uint8_t 
*buf, int buflen)
 skip_bits_long(gb, 16 + 16 + 1 + 16);
 
 extensions = jpegxl_u64(gb);
+if (get_bits_left(gb) < 1)
+return AVERROR_INVALIDDATA;
 if (extensions) {
 for (int i = 0; i < 64; i++) {
 if (extensions & (UINT64_C(1) << i))
 jpegxl_u64(gb);
+if (get_bits_left(gb) < 1)
+return AVERROR_INVALIDDATA;
 }
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Jun  8 10:26:33 2023 -0400| [4e68048151a43e08265548024ec9e98dc6028f50] | 
committer: Michael Niedermayer

avformat/jpegxl_probe: Remove intermediate macro obfuscation around get_bits*()

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 25c937c0e03895866d9f5bcc659ad6afc53e20f9)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e68048151a43e08265548024ec9e98dc6028f50
---

 libavformat/jpegxl_probe.c | 169 +++--
 1 file changed, 85 insertions(+), 84 deletions(-)

diff --git a/libavformat/jpegxl_probe.c b/libavformat/jpegxl_probe.c
index 3de002f004..45f464ffaf 100644
--- a/libavformat/jpegxl_probe.c
+++ b/libavformat/jpegxl_probe.c
@@ -57,49 +57,50 @@ enum JpegXLPrimaries {
 FF_JPEGXL_PR_P3 = 11,
 };
 
-#define jxl_bits(n) get_bits_long(gb, (n))
-#define jxl_bits_skip(n) skip_bits_long(gb, (n))
-#define jxl_u32(c0, c1, c2, c3, u0, u1, u2, u3) jpegxl_u32(gb, \
-(const uint32_t[]){c0, c1, c2, c3}, (const uint32_t[]){u0, u1, u2, u3})
-#define jxl_u64() jpegxl_u64(gb)
-#define jxl_enum() jxl_u32(0, 1, 2, 18, 0, 0, 4, 6)
-
 /* read a U32(c_i + u(u_i)) */
-static uint32_t jpegxl_u32(GetBitContext *gb,
-   const uint32_t constants[4], const uint32_t 
ubits[4])
+static av_always_inline uint32_t jxl_u32(GetBitContext *gb,
+uint32_t c0, uint32_t c1, uint32_t c2, uint32_t c3,
+uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3)
 {
-uint32_t ret, choice = jxl_bits(2);
+const uint32_t constants[4] = {c0, c1, c2, c3};
+const uint32_t ubits[4] = {u0, u1, u2, u3};
+uint32_t ret, choice = get_bits(gb, 2);
 
 ret = constants[choice];
 if (ubits[choice])
-ret += jxl_bits(ubits[choice]);
+ret += get_bits_long(gb, ubits[choice]);
 
 return ret;
 }
 
+static av_always_inline uint32_t jxl_enum(GetBitContext *gb)
+{
+return jxl_u32(gb, 0, 1, 2, 18, 0, 0, 4, 6);
+}
+
 /* read a U64() */
 static uint64_t jpegxl_u64(GetBitContext *gb)
 {
 uint64_t shift = 12, ret;
 
-switch (jxl_bits(2)) {
+switch (get_bits(gb, 2)) {
 case 0:
 ret = 0;
 break;
 case 1:
-ret = 1 + jxl_bits(4);
+ret = 1 + get_bits(gb, 4);
 break;
 case 2:
-ret = 17 + jxl_bits(8);
+ret = 17 + get_bits(gb, 8);
 break;
 case 3:
-ret = jxl_bits(12);
-while (jxl_bits(1)) {
+ret = get_bits(gb, 12);
+while (get_bits1(gb)) {
 if (shift < 60) {
-ret |= (uint64_t)jxl_bits(8) << shift;
+ret |= (uint64_t)get_bits(gb, 8) << shift;
 shift += 8;
 } else {
-ret |= (uint64_t)jxl_bits(4) << shift;
+ret |= (uint64_t)get_bits(gb, 4) << shift;
 break;
 }
 }
@@ -142,18 +143,18 @@ static int jpegxl_read_size_header(GetBitContext *gb)
 {
 uint32_t width, height;
 
-if (jxl_bits(1)) {
+if (get_bits1(gb)) {
 /* small size header */
-height = (jxl_bits(5) + 1) << 3;
-width = jpegxl_width_from_ratio(height, jxl_bits(3));
+height = (get_bits(gb, 5) + 1) << 3;
+width = jpegxl_width_from_ratio(height, get_bits(gb, 3));
 if (!width)
-width = (jxl_bits(5) + 1) << 3;
+width = (get_bits(gb, 5) + 1) << 3;
 } else {
 /* large size header */
-height = 1 + jxl_u32(0, 0, 0, 0, 9, 13, 18, 30);
-width = jpegxl_width_from_ratio(height, jxl_bits(3));
+height = 1 + jxl_u32(gb, 0, 0, 0, 0, 9, 13, 18, 30);
+width = jpegxl_width_from_ratio(height, get_bits(gb, 3));
 if (!width)
-width = 1 + jxl_u32(0, 0, 0, 0, 9, 13, 18, 30);
+width = 1 + jxl_u32(gb, 0, 0, 0, 0, 9, 13, 18, 30);
 }
 if (width > (1 << 18) || height > (1 << 18)
 || (width >> 4) * (height >> 4) > (1 << 20))
@@ -170,18 +171,18 @@ static int jpegxl_read_preview_header(GetBitContext *gb)
 {
 uint32_t width, height;
 
-if (jxl_bits(1)) {
+if (get_bits1(gb)) {
 /* coded height and width divided by eight */
-height = jxl_u32(16, 32, 1, 33, 0, 0, 5, 9) << 3;
-width = jpegxl_width_from_ratio(height, jxl_bits(3));
+height = jxl_u32(gb, 16, 32, 1, 33, 0, 0, 5, 9) << 3;
+width = jpegxl_width_from_ratio(height, get_bits(gb, 3));
 if (!width)
-width = jxl_u32(16, 32, 1, 33, 0, 0, 5, 9) << 3;
+width = jxl_u32(gb, 16, 32, 1, 33, 0, 0, 5, 9) << 3;
 } else {
 /* full height and width coded */
-height = jxl_u32(1, 65, 321, 1345, 6, 8, 10, 12);
-width = jpegxl_width_from_ratio(height, jxl_bits(3));
+height = jxl_u32(gb, 1, 65, 321, 1345, 6, 8, 10, 12);
+width = jpegxl_width_from_ratio(height, get_bits(gb, 3));
 if 

[FFmpeg-cvslog] avcodec/noise_bsf: Check for wrapped frames

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jun  4 19:59:40 2023 +0200| [2cb93e863fac9ad32ae5901186b59eb23c047e64] | 
committer: Michael Niedermayer

avcodec/noise_bsf: Check for wrapped frames

Wrapped frames contain pointers so they need specific code to
noise them, the generic code would lead to segfaults

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0889ebc577749ee6abc620bc9030d2002487935f)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cb93e863fac9ad32ae5901186b59eb23c047e64
---

 libavcodec/noise_bsf.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
index 168f3aa373..7bdaa3c1db 100644
--- a/libavcodec/noise_bsf.c
+++ b/libavcodec/noise_bsf.c
@@ -86,6 +86,12 @@ static int noise_init(AVBSFContext *ctx)
 return AVERROR(ENOMEM);
 }
 
+if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME &&
+strcmp(s->amount_str, "0")) {
+av_log(ctx, AV_LOG_ERROR, "Wrapped AVFrame noising is unsupported\n");
+return AVERROR_PATCHWELCOME;
+}
+
 ret = av_expr_parse(>amount_pexpr, s->amount_str,
 var_names, NULL, NULL, NULL, NULL, 0, ctx);
 if (ret < 0) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 16 allocated

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 16:56:40 2023 +0200| [0c2b08227ef52babedf8659035e359bfa4fed374] | 
committer: Michael Niedermayer

avcodec/utils: the IFF_ILBM implementation assumes that there are a multiple of 
16 allocated

Fixes: out of array access
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5124452659888128
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-6362836707442688

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 34056a94eab5f8fbc7e0b8510f7c9851931f23b7)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c2b08227ef52babedf8659035e359bfa4fed374
---

 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ef5c785ced..add1e2139b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -316,7 +316,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 }
 
 if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
-w_align = FFMAX(w_align, 8);
+w_align = FFMAX(w_align, 16);
 }
 
 *width  = FFALIGN(*width, w_align);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/sonic: Fix two undefined integer overflows

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 17:19:10 2023 +0200| [2878299b730ebe0b82ca2af65b3a9ca64f944d4f] | 
committer: Michael Niedermayer

avcodec/sonic: Fix two undefined integer overflows

Fixes: signed integer overflow: 2147483372 - -148624 cannot be represented in 
type 'int'
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-5477177805373440
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SONIC_fuzzer-6681622236233728

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 2632e9049391d820bde64d1fc138567a66464fcd)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2878299b730ebe0b82ca2af65b3a9ca64f944d4f
---

 libavcodec/sonic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index dfb055d80e..2fc8a1f6f4 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -473,7 +473,7 @@ static void predictor_init_state(int *k, int *state, int 
order)
 
 static int predictor_calc_error(int *k, int *state, int order, int error)
 {
-int i, x = error - shift_down(k[order-1] *  (unsigned)state[order-1], 
LATTICE_SHIFT);
+int i, x = error - (unsigned)shift_down(k[order-1] *  
(unsigned)state[order-1], LATTICE_SHIFT);
 
 #if 1
 int *k_ptr = &(k[order-2]),
@@ -1013,7 +1013,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 if (s->lossless)
 quant = 1;
 else
-quant = get_symbol(, state, 0) * SAMPLE_FACTOR;
+quant = get_symbol(, state, 0) * (unsigned)SAMPLE_FACTOR;
 
 //av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 17:38:39 2023 +0200| [7337f2e8e36b5bbadb9170a0e30b988cc4392540] | 
committer: Michael Niedermayer

avcodec/tiff: add a zero DNG_LINEARIZATION_TABLE check

Fixes: index 4294967295 out of bounds for type 'uint16_t [65536]'
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5950405086674944
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-195176914944

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6e98cf0280cd693ef82cfe15bc7aef8771b3)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7337f2e8e36b5bbadb9170a0e30b988cc4392540
---

 libavcodec/tiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 717f299fdd..b4a1c2f040 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1416,7 +1416,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
 s->sub_ifd = ff_tget(>gb, TIFF_LONG, s->le); /** Only get the 
first SubIFD */
 break;
 case DNG_LINEARIZATION_TABLE:
-if (count > FF_ARRAY_ELEMS(s->dng_lut))
+if (count < 1 || count > FF_ARRAY_ELEMS(s->dng_lut))
 return AVERROR_INVALIDDATA;
 for (int i = 0; i < count; i++)
 s->dng_lut[i] = ff_tget(>gb, type, s->le);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 17:34:16 2023 +0200| [f174aa713455bb48f4de22df223f17d0a851660f] | 
committer: Michael Niedermayer

avcodec/tak: Check remaining bits in ff_tak_decode_frame_header()

Fixes: out of array access
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-6682195323650048

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 19b66b89da4b4ff086dc1fc79bbf540e82bdbcb4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f174aa713455bb48f4de22df223f17d0a851660f
---

 libavcodec/tak.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/tak.c b/libavcodec/tak.c
index 7221a80094..a19b2779e2 100644
--- a/libavcodec/tak.c
+++ b/libavcodec/tak.c
@@ -168,6 +168,9 @@ int ff_tak_decode_frame_header(AVCodecContext *avctx, 
GetBitContext *gb,
 if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA)
 return AVERROR_INVALIDDATA;
 
+if (get_bits_left(gb) < 24)
+return AVERROR_INVALIDDATA;
+
 skip_bits(gb, 24);
 
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/exr: Cleanup befor return

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 15:18:45 2023 +0200| [b9c79be72639e0d84409e3ee4f987de77cee054d] | 
committer: Michael Niedermayer

avcodec/exr: Cleanup befor return

Fixes: leaks
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6703454090559488

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 885ff3b8798791eb2b0f53360a2ab4b1f9c5f6dc)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9c79be72639e0d84409e3ee4f987de77cee054d
---

 libavcodec/exr.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 91a567cd41..c8db720904 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1943,8 +1943,10 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 
 bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));
 if (strncmp("scanlineimage", key, var_size) &&
-strncmp("tiledimage", key, var_size))
-return AVERROR_PATCHWELCOME;
+strncmp("tiledimage", key, var_size)) {
+ret = AVERROR_PATCHWELCOME;
+goto fail;
+}
 
 continue;
 } else if ((var_size = check_header_variable(s, "preview",
@@ -1952,12 +1954,16 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 uint32_t pw = bytestream2_get_le32(gb);
 uint32_t ph = bytestream2_get_le32(gb);
 uint64_t psize = pw * ph;
-if (psize > INT64_MAX / 4)
-return AVERROR_INVALIDDATA;
+if (psize > INT64_MAX / 4) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 psize *= 4;
 
-if ((int64_t)psize >= bytestream2_get_bytes_left(gb))
-return AVERROR_INVALIDDATA;
+if ((int64_t)psize >= bytestream2_get_bytes_left(gb)) {
+ret = AVERROR_INVALIDDATA;
+goto fail;
+}
 
 bytestream2_skip(gb, psize);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/pngdec: Do not pass AVFrame into global header decode

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 15:06:59 2023 +0200| [13644a75d831f8978e5ad8b4fe4c571192f3fda8] | 
committer: Michael Niedermayer

avcodec/pngdec: Do not pass AVFrame into global header decode

The global header should not contain a frame, and decoding it
would result in leaks

Fixes: memleak
Fixes: 
45982/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APNG_fuzzer-6603443149340672

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit d31d4f32283f765c79d6e127d31ee2c37a0acef7)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13644a75d831f8978e5ad8b4fe4c571192f3fda8
---

 libavcodec/pngdec.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 85cf40d1f8..b085154fbc 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -640,6 +640,8 @@ static int decode_idat_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 int ret;
 size_t byte_depth = s->bit_depth > 8 ? 2 : 1;
 
+if (!p)
+return AVERROR_INVALIDDATA;
 if (!(s->hdr_state & PNG_IHDR)) {
 av_log(avctx, AV_LOG_ERROR, "IDAT without IHDR\n");
 return AVERROR_INVALIDDATA;
@@ -1358,6 +1360,9 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 }
 exit_loop:
 
+if (!p)
+return AVERROR_INVALIDDATA;
+
 if (avctx->codec_id == AV_CODEC_ID_PNG &&
 avctx->skip_frame == AVDISCARD_ALL) {
 return 0;
@@ -1596,7 +1601,7 @@ static int decode_frame_apng(AVCodecContext *avctx, 
AVFrame *p,
 if ((ret = inflateReset(>zstream.zstream)) != Z_OK)
 return AVERROR_EXTERNAL;
 bytestream2_init(>gb, avctx->extradata, avctx->extradata_size);
-if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0)
+if ((ret = decode_frame_common(avctx, s, NULL, avpkt)) < 0)
 return ret;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr 16 15:05:47 2023 +0200| [ac015347a8034b61353c633dbfeaa5c8ac79de2c] | 
committer: Michael Niedermayer

avcodec/pngdec: remove AVFrame argument from decode_iccp_chunk()

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 7117b380a7eb9419625aa8835edec2c3c17e638b)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac015347a8034b61353c633dbfeaa5c8ac79de2c
---

 libavcodec/pngdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 9f142980a0..85cf40d1f8 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -876,7 +876,7 @@ static int decode_trns_chunk(AVCodecContext *avctx, 
PNGDecContext *s,
 return 0;
 }
 
-static int decode_iccp_chunk(PNGDecContext *s, GetByteContext *gb, AVFrame *f)
+static int decode_iccp_chunk(PNGDecContext *s, GetByteContext *gb)
 {
 int ret, cnt = 0;
 AVBPrint bp;
@@ -1313,7 +1313,7 @@ static int decode_frame_common(AVCodecContext *avctx, 
PNGDecContext *s,
 break;
 }
 case MKTAG('i', 'C', 'C', 'P'): {
-if ((ret = decode_iccp_chunk(s, _chunk, p)) < 0)
+if ((ret = decode_iccp_chunk(s, _chunk)) < 0)
 goto fail;
 break;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/tx_priv: Use unsigned in BF() to avoid signed overflows

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Jan 22 00:51:05 2023 +0100| [66192786e7abc7fc4b303243676df175df388e2a] | 
committer: Michael Niedermayer

avutil/tx_priv: Use unsigned in BF() to avoid signed overflows

Fixes: signed integer overflow: 100183269 - -2132769113 cannot be represented 
in type 'int'
Fixes: 
55063/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5039294027005952

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit eddf7e2a3e9459fd26a76fb2984a6c9b994e2d89)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66192786e7abc7fc4b303243676df175df388e2a
---

 libavutil/tx_priv.h | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index 3dd748bd2c..6acbede0f4 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -101,6 +101,12 @@ typedef void TXComplex;
 
 #define FOLD(a, b) ((a) + (b))
 
+#define BF(x, y, a, b)  \
+do {\
+x = (a) - (b);  \
+y = (a) + (b);  \
+} while (0)
+
 #elif defined(TX_INT32)
 
 /* Properly rounds the result */
@@ -131,14 +137,14 @@ typedef void TXComplex;
 
 #define FOLD(x, y) ((int32_t)((x) + (unsigned)(y) + 32) >> 6)
 
-#endif /* TX_INT32 */
-
 #define BF(x, y, a, b)  \
 do {\
-x = (a) - (b);  \
-y = (a) + (b);  \
+x = (a) - (unsigned)(b);  \
+y = (a) + (unsigned)(b);  \
 } while (0)
 
+#endif /* TX_INT32 */
+
 #define CMUL3(c, a, b) CMUL((c).re, (c).im, (a).re, (a).im, (b).re, (b).im)
 
 /* Codelet flags, used to pick codelets. Must be a superset of enum AVTXFlags,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/vorbisdec: Check codebook float values to be finite

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Feb 12 22:49:01 2023 +0100| [efcb8211577b47a21ac0ab8ba2b8597be93ee0c2] | 
committer: Michael Niedermayer

avcodec/vorbisdec: Check codebook float values to be finite

Fixes: Timeout
Fixes: 
55116/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VORBIS_fuzzer-4572159970508800

Signed-off-by: Michael Niedermayer 
(cherry picked from commit cadd7e7a7589b5c118ad1648a09c629a6b65a3be)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efcb8211577b47a21ac0ab8ba2b8597be93ee0c2
---

 libavcodec/vorbisdec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 6ba0e1d811..269a6eb166 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -364,6 +364,10 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context 
*vc)
 unsigned codebook_value_bits = get_bits(gb, 4) + 1;
 unsigned codebook_sequence_p = get_bits1(gb);
 
+if (!isfinite(codebook_minimum_value) || 
!isfinite(codebook_delta_value)) {
+ret = AVERROR_INVALIDDATA;
+goto error;
+}
 ff_dlog(NULL, " We expect %d numbers for building the codevectors. 
\n",
 codebook_lookup_values);
 ff_dlog(NULL, "  delta %f minmum %f \n",

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/lcldec: More space for rgb24

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar  9 13:57:17 2023 +0100| [1480cc1d9c8ca441fae2f9524aeedb14ca8876ac] | 
committer: Michael Niedermayer

avcodec/lcldec: More space for rgb24

Fixes: Ticket 10239
Fixes: zlib_306_306_rgb24.av

Signed-off-by: Michael Niedermayer 
(cherry picked from commit e2c3aa8e2b800c5b860315277b3ea426b8b23393)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1480cc1d9c8ca441fae2f9524aeedb14ca8876ac
---

 libavcodec/lcldec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 4a05680603..1c52700762 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -152,6 +152,8 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t 
*src, int src_len, i
 if (expected != (unsigned int)zstream->total_out) {
 av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
expected, zstream->total_out);
+if (expected > (unsigned int)zstream->total_out)
+return (unsigned int)zstream->total_out;
 return AVERROR_UNKNOWN;
 }
 return zstream->total_out;
@@ -276,12 +278,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - 
mthread_inlen,
   mthread_outlen, mthread_outlen);
 if (ret < 0) return ret;
+len = c->decomp_size;
 } else {
 int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
 if (ret < 0) return ret;
+len = ret;
 }
 encoded = c->decomp_buf;
-len = c->decomp_size;
 break;
 #endif
 default:
@@ -519,7 +522,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 partial_h_supported = 1;
 break;
 case IMGTYPE_RGB24:
-c->decomp_size = basesize * 3;
+c->decomp_size = FFALIGN(avctx->width*3, 4) * avctx->height;
 max_decomp_size = max_basesize * 3;
 avctx->pix_fmt = AV_PIX_FMT_BGR24;
 av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/g2meet: Replace fake allocation avoidance for framebuf

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Tue Jan 24 22:48:46 2023 +0100| [c2b46db3f439ea39bf401b011c0fe6bbaeb0b6b6] | 
committer: Michael Niedermayer

avcodec/g2meet: Replace fake allocation avoidance for framebuf

framebuf is only allocated when the new width/height are larger than the old
but nothing sets the old so its always allocated.
Use av_fast_mallocz() instead.

Fixes: Timeout
Fixes: 
55094/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5116909932904448

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 38adbc6eebd7f2f34ecf1b0b18019e88bad9d9f4)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2b46db3f439ea39bf401b011c0fe6bbaeb0b6b6
---

 libavcodec/g2meet.c | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 00964369c5..ee1eaf9e6f 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -146,7 +146,8 @@ typedef struct G2MContext {
 intgot_header;
 
 uint8_t*framebuf;
-intframebuf_stride, old_width, old_height;
+intframebuf_stride;
+unsigned int framebuf_allocated;
 
 uint8_t*synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base;
 inttile_stride, epic_buf_stride, old_tile_w, old_tile_h;
@@ -1161,14 +1162,13 @@ static int g2m_init_buffers(G2MContext *c)
 {
 int aligned_height;
 
-if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {
-c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
-aligned_height = c->height + 15;
-av_free(c->framebuf);
-c->framebuf = av_calloc(c->framebuf_stride, aligned_height);
-if (!c->framebuf)
-return AVERROR(ENOMEM);
-}
+c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
+aligned_height = c->height + 15;
+
+av_fast_mallocz(>framebuf, >framebuf_allocated, c->framebuf_stride * 
aligned_height);
+if (!c->framebuf)
+return AVERROR(ENOMEM);
+
 if (!c->synth_tile || !c->jpeg_tile ||
 (c->compression == 2 && !c->epic_buf_base) ||
 c->old_tile_w < c->tile_width ||
@@ -1618,6 +1618,7 @@ static av_cold int g2m_decode_end(AVCodecContext *avctx)
 av_freep(>jpeg_tile);
 av_freep(>cursor);
 av_freep(>framebuf);
+c->framebuf_allocated = 0;
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar  9 13:57:15 2023 +0100| [002471255d334267cbe4b66da0b3bb339b8ef2c9] | 
committer: Michael Niedermayer

avcodec/lcldec: Support 4:1:1 and 4:2:2 with odd width

Fixes: Ticket10240
Fixes: zlib_306_306_yuv422.avi
Fixes: zlib_306_306_yuv411.avi

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0cf1ac905d2d97355a389c3baa4e132824b29f21)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=002471255d334267cbe4b66da0b3bb339b8ef2c9
---

 libavcodec/lcldec.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 1bea618eeb..4a05680603 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -403,6 +403,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 v_out[ col >> 1 ] = *encoded++ + 128;
 v_out[(col >> 1) + 1] = *encoded++ + 128;
 }
+if (col && col < width) {
+u_out[ col >> 1 ] = u_out[(col>>1) - 1];
+v_out[ col >> 1 ] = v_out[(col>>1) - 1];
+}
+
 y_out -= frame->linesize[0];
 u_out -= frame->linesize[1];
 v_out -= frame->linesize[2];
@@ -424,6 +429,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 u_out[col >> 2] = *encoded++ + 128;
 v_out[col >> 2] = *encoded++ + 128;
 }
+if (col && col < width) {
+u_out[col >> 2] = u_out[(col>>2) - 1];
+v_out[col >> 2] = v_out[(col>>2) - 1];
+}
 y_out -= frame->linesize[0];
 u_out -= frame->linesize[1];
 v_out -= frame->linesize[2];
@@ -481,6 +490,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 FFALIGN(avctx->height, 4);
 unsigned int max_decomp_size;
 int subsample_h, subsample_v;
+int partial_h_supported = 0;
 
 if (avctx->extradata_size < 8) {
 av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
@@ -502,14 +512,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
 break;
 case IMGTYPE_YUV422:
-c->decomp_size = basesize * 2;
+c->decomp_size = (avctx->width & ~3) * avctx->height * 2;
 max_decomp_size = max_basesize * 2;
 avctx->pix_fmt = AV_PIX_FMT_YUV422P;
 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
-if (avctx->width % 4) {
-avpriv_request_sample(avctx, "Unsupported dimensions");
-return AVERROR_INVALIDDATA;
-}
+partial_h_supported = 1;
 break;
 case IMGTYPE_RGB24:
 c->decomp_size = basesize * 3;
@@ -518,10 +525,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
 break;
 case IMGTYPE_YUV411:
-c->decomp_size = basesize / 2 * 3;
+c->decomp_size = (avctx->width & ~3) * avctx->height / 2 * 3;
 max_decomp_size = max_basesize / 2 * 3;
 avctx->pix_fmt = AV_PIX_FMT_YUV411P;
 av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
+partial_h_supported = 1;
 break;
 case IMGTYPE_YUV211:
 c->decomp_size = basesize * 2;
@@ -541,7 +549,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 }
 
 av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, _h, 
_v);
-if (avctx->width % (1

[FFmpeg-cvslog] libavcodec/lcldec: width and height should not be unsigned

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar  9 13:57:14 2023 +0100| [8abcd8b124bc83136c6de2823dd388eff37a75dd] | 
committer: Michael Niedermayer

libavcodec/lcldec: width and height should not be unsigned

Computations like col < width - 3 will not work with unsigned width=1

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 3eb4e28c26c3bce608214f392ab1fe6ee28ec1df)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8abcd8b124bc83136c6de2823dd388eff37a75dd
---

 libavcodec/lcldec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index ffa2fe5a6d..1bea618eeb 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -169,8 +169,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame 
*frame,
 int row, col;
 unsigned char *encoded = avpkt->data, *outptr;
 uint8_t *y_out, *u_out, *v_out;
-unsigned int width = avctx->width; // Real image width
-unsigned int height = avctx->height; // Real image height
+int width = avctx->width; // Real image width
+int height = avctx->height; // Real image height
 unsigned int mszh_dlen;
 unsigned char yq, y1q, uq, vq;
 int uqvq, ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/imf: fix invalid resource handling

2023-10-29 Thread Pierre-Anthony Lemieux
ffmpeg | branch: release/5.1 | Pierre-Anthony Lemieux  | 
Wed Apr 26 08:09:40 2023 -0700| [c2d4ab255259c864313d433c5755fad2bf0219f4] | 
committer: Michael Niedermayer

avformat/imf: fix invalid resource handling

(cherry picked from commit 23d968d55a6e00dfc46799cfd0eb2ed02379037d)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2d4ab255259c864313d433c5755fad2bf0219f4
---

 libavformat/imf_cpl.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 4acc20feee..f2c6b6f064 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -511,11 +511,10 @@ static int push_main_audio_sequence(xmlNodePtr 
audio_sequence_elem, FFIMFCPL *cp
 ret = fill_trackfile_resource(resource_elem,
   >resources[vt->resource_count],
   cpl);
-vt->resource_count++;
-if (ret) {
+if (ret)
 av_log(NULL, AV_LOG_ERROR, "Invalid Resource\n");
-continue;
-}
+else
+vt->resource_count++;
 
 resource_elem = xmlNextElementSibling(resource_elem);
 }
@@ -594,11 +593,10 @@ static int push_main_image_2d_sequence(xmlNodePtr 
image_sequence_elem, FFIMFCPL
 ret = fill_trackfile_resource(resource_elem,
   
>main_image_2d_track->resources[cpl->main_image_2d_track->resource_count],
   cpl);
-cpl->main_image_2d_track->resource_count++;
-if (ret) {
+if (ret)
 av_log(NULL, AV_LOG_ERROR, "Invalid Resource\n");
-continue;
-}
+else
+cpl->main_image_2d_track->resource_count++;
 
 resource_elem = xmlNextElementSibling(resource_elem);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: Replace RGB24 special case by generic test

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:57:56 2023 +0200| [7c5d1725aab390245a44c191b285eb0f8b2eddd7] | 
committer: Michael Niedermayer

avcodec/j2kenc: Replace RGB24 special case by generic test

This fixes RGB48 with libavcodec as decoder

Signed-off-by: Michael Niedermayer 
(cherry picked from commit ad4d647591dbd953a5cf3a32a779ee5e42465bbb)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c5d1725aab390245a44c191b285eb0f8b2eddd7
---

 libavcodec/j2kenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index b37820278d..e11b41ab46 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1530,6 +1530,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 int tileno, ret;
 Jpeg2000EncoderContext *s = avctx->priv_data;
 uint8_t *chunkstart, *jp2cstart, *jp2hstart;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 
 if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + 
AV_INPUT_BUFFER_MIN_SIZE)) < 0)
 return ret;
@@ -1586,7 +1587,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 bytestream_put_byte(>buf, 1);
 bytestream_put_byte(>buf, 0);
 bytestream_put_byte(>buf, 0);
-if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == 
AV_PIX_FMT_PAL8) {
+if ((desc->flags & AV_PIX_FMT_FLAG_RGB) || avctx->pix_fmt == 
AV_PIX_FMT_PAL8) {
 bytestream_put_be32(>buf, 16);
 } else if (s->ncomponents == 1) {
 bytestream_put_be32(>buf, 17);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/escape124: Check that blocks are allocated before use

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr  9 15:18:55 2023 +0200| [d1553cad73e72d7b7d256d4cf7dcb38c0ae1f375] | 
committer: Michael Niedermayer

avcodec/escape124: Check that blocks are allocated before use

Fixes: NULL pointer dereference
Fixes: 
57819/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-5077280228769792

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 5366ae12b9ba60404822f6b39b41f6c0d98a7c8a)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1553cad73e72d7b7d256d4cf7dcb38c0ae1f375
---

 libavcodec/escape124.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 0f996bf95c..16626ad5b7 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -158,7 +158,7 @@ static MacroBlock decode_macroblock(Escape124Context* s, 
GetBitContext* gb,
 
 // This condition can occur with invalid bitstreams and
 // *codebook_index == 2
-if (block_index >= s->codebooks[*codebook_index].size)
+if (block_index >= s->codebooks[*codebook_index].size || 
!s->codebooks[*codebook_index].blocks)
 return (MacroBlock) { { 0 } };
 
 return s->codebooks[*codebook_index].blocks[block_index];

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/huffyuvdec: Fix undefined behavior with shift

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Apr  9 13:18:42 2023 +0200| [7158ad82da404814371f5d11e59f9dd5e51a805d] | 
committer: Michael Niedermayer

avcodec/huffyuvdec: Fix undefined behavior with shift

Fixes: left shift of negative value -1
Fixes: 
57554/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFVHUFF_fuzzer-4853603839115264

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 27e7857bd1127974ffe1512293abee83b1035194)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7158ad82da404814371f5d11e59f9dd5e51a805d
---

 libavcodec/huffyuvdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index acc4aafdc2..6862376c44 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -656,9 +656,9 @@ static void decode_422_bitstream(HYuvContext *s, int count)
 /* TODO instead of restarting the read when the code isn't in the first level
  * of the joint table, jump into the 2nd level of the individual table. */
 #define READ_2PIX_PLANE16(dst0, dst1, plane){\
-dst0 = get_vlc2(>gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
+dst0 = get_vlc2(>gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
 dst0 += get_bits(>gb, 2);\
-dst1 = get_vlc2(>gb, s->vlc[plane].table, VLC_BITS, 3)<<2;\
+dst1 = get_vlc2(>gb, s->vlc[plane].table, VLC_BITS, 3)*4;\
 dst1 += get_bits(>gb, 2);\
 }
 static void decode_plane_bitstream(HYuvContext *s, int width, int plane)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: remove misleading pred value

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:18:05 2023 +0200| [1990527edbdee2376bb37f2808a4eb8c3da59ba9] | 
committer: Michael Niedermayer

avcodec/j2kenc: remove misleading pred value

This field is only checked for being 0 or not and not zero means 5/3

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 0adb375377f369b69b24d86bbfe674b7693ccf3c)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1990527edbdee2376bb37f2808a4eb8c3da59ba9
---

 libavcodec/j2kenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 550ad9081c..4c124a89c7 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1729,7 +1729,7 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
 
 if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (s->pred != FF_DWT97_INT || 
s->format != CODEC_JP2)) {
 av_log(s->avctx, AV_LOG_WARNING, "Forcing lossless jp2 for pal8\n");
-s->pred = FF_DWT97_INT;
+s->pred = 1;
 s->format = CODEC_JP2;
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: simplify pixel format setup

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:40:31 2023 +0200| [cf6ae79a71e302b25e6cd32314d46a5740340e8a] | 
committer: Michael Niedermayer

avcodec/j2kenc: simplify pixel format setup

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 644d15716d5cfb28e4ea0c0ada163f70807e9a5c)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf6ae79a71e302b25e6cd32314d46a5740340e8a
---

 libavcodec/j2kenc.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 67dad9f1b7..fbb2f991ca 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1716,6 +1716,7 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
 Jpeg2000EncoderContext *s = avctx->priv_data;
 Jpeg2000CodingStyle *codsty = >codsty;
 Jpeg2000QuantStyle  *qntsty = >qntsty;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
 
 s->avctx = avctx;
 av_log(s->avctx, AV_LOG_DEBUG, "init\n");
@@ -1758,20 +1759,13 @@ static av_cold int j2kenc_init(AVCodecContext *avctx)
 s->width = avctx->width;
 s->height = avctx->height;
 
+s->ncomponents = desc->nb_components;
 for (i = 0; i < 3; i++) {
-if (avctx->pix_fmt == AV_PIX_FMT_GRAY16 || avctx->pix_fmt == 
AV_PIX_FMT_RGB48)
-s->cbps[i] = 16;
-else
-s->cbps[i] = 8;
+s->cbps[i] = desc->comp[i].depth;
 }
 
-if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == 
AV_PIX_FMT_RGB48){
-s->ncomponents = 3;
-} else if (avctx->pix_fmt == AV_PIX_FMT_GRAY8 || avctx->pix_fmt == 
AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY16){
-s->ncomponents = 1;
-} else{ // planar YUV
+if ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) && s->ncomponents > 1) {
 s->planar = 1;
-s->ncomponents = 3;
 ret = av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt,
s->chroma_shift, 
s->chroma_shift + 1);
 if (ret)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:50:26 2023 +0200| [4c07c4d29aae017584ea2a4273901c4799ea5b75] | 
committer: Michael Niedermayer

avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits

BGR48 is not supported and this was probably meant to be RGB48 so this fixes
RGB48 a bit

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 7fb70d27a26bb4072edf68857636fa4343ee24a3)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c07c4d29aae017584ea2a4273901c4799ea5b75
---

 libavcodec/j2kenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index fbb2f991ca..b37820278d 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1542,7 +1542,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 
 s->lambda = s->picture->quality * LAMBDA_SCALE;
 
-if (avctx->pix_fmt == AV_PIX_FMT_BGR48 || avctx->pix_fmt == 
AV_PIX_FMT_GRAY16)
+if (s->cbps[0] > 8)
 copy_frame_16(s);
 else
 copy_frame_8(s);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: fix 5/3 DWT identifer

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:15:36 2023 +0200| [f38e5efbf2a905a67f2241a0a8de3210a5174473] | 
committer: Michael Niedermayer

avcodec/j2kenc: fix 5/3 DWT identifer

Signed-off-by: Michael Niedermayer 
(cherry picked from commit f6955b6df4b599ff5604e82987b96957414f8dd5)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f38e5efbf2a905a67f2241a0a8de3210a5174473
---

 libavcodec/j2kenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index ce77a6d964..550ad9081c 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1810,7 +1810,7 @@ static const AVOption options[] = {
 { "tile_height",   "Tile Height",   OFFSET(tile_height),   
AV_OPT_TYPE_INT,   { .i64 = 256 }, 1, 1<<30,   VE, },
 { "pred",  "DWT Type",  OFFSET(pred),  
AV_OPT_TYPE_INT,   { .i64 = 0   }, 0, 1,   VE, "pred"   
 },
 { "dwt97int",  NULL,0, 
AV_OPT_TYPE_CONST, { .i64 = 0   }, INT_MIN, INT_MAX,   VE, "pred"   
 },
-{ "dwt53", NULL,0, 
AV_OPT_TYPE_CONST, { .i64 = 0   }, INT_MIN, INT_MAX,   VE, "pred"   
 },
+{ "dwt53", NULL,0, 
AV_OPT_TYPE_CONST, { .i64 = 1   }, INT_MIN, INT_MAX,   VE, "pred"   
 },
 { "sop",   "SOP marker",OFFSET(sop),   
AV_OPT_TYPE_INT,   { .i64 = 0   }, 0, 1,   VE, },
 { "eph",   "EPH marker",OFFSET(eph),   
AV_OPT_TYPE_INT,   { .i64 = 0   }, 0, 1,   VE, },
 { "prog",  "Progression Order", OFFSET(prog),  
AV_OPT_TYPE_INT,   { .i64 = 0   }, JPEG2000_PGOD_LRCP, 
JPEG2000_PGOD_CPRL,   VE, "prog" },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/j2kenc: Fix funky bpno errors on decoding

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Thu Mar 30 18:21:28 2023 +0200| [0ab5965b691debefd8341463b94c16ce6f8586f2] | 
committer: Michael Niedermayer

avcodec/j2kenc: Fix funky bpno errors on decoding

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 816676085e3d32f27d4001d9b95590046c487eb6)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ab5965b691debefd8341463b94c16ce6f8586f2
---

 libavcodec/j2kenc.c  | 3 +--
 tests/ref/vsynth/vsynth1-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth2-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth2-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth3-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth3-jpeg2000-97 | 4 ++--
 tests/ref/vsynth/vsynth_lena-jpeg2000| 4 ++--
 tests/ref/vsynth/vsynth_lena-jpeg2000-97 | 4 ++--
 8 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 4c124a89c7..67dad9f1b7 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -721,11 +721,10 @@ static void encode_cblk(Jpeg2000EncoderContext *s, 
Jpeg2000T1Context *t1, Jpeg20
 
 if (max == 0){
 cblk->nonzerobits = 0;
-bpno = 0;
 } else{
 cblk->nonzerobits = av_log2(max) + 1 - NMSEDEC_FRACBITS;
-bpno = cblk->nonzerobits - 1;
 }
+bpno = cblk->nonzerobits - 1;
 
 cblk->data[0] = 0;
 ff_mqc_initenc(>mqc, cblk->data + 1);
diff --git a/tests/ref/vsynth/vsynth1-jpeg2000-97 
b/tests/ref/vsynth/vsynth1-jpeg2000-97
index 6ab5aa4237..c979ab5c36 100644
--- a/tests/ref/vsynth/vsynth1-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth1-jpeg2000-97
@@ -1,4 +1,4 @@
-e4d03b2e3c03e56c7f831b1e662c4031 *tests/data/fate/vsynth1-jpeg2000-97.avi
-3643928 tests/data/fate/vsynth1-jpeg2000-97.avi
+5e6d32b7205d31245b0d1f015d08b515 *tests/data/fate/vsynth1-jpeg2000-97.avi
+3643886 tests/data/fate/vsynth1-jpeg2000-97.avi
 a2262f1da2f49bc196b780a6b47ec4e8 
*tests/data/fate/vsynth1-jpeg2000-97.out.rawvideo
 stddev:4.23 PSNR: 35.59 MAXDIFF:   53 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-jpeg2000 
b/tests/ref/vsynth/vsynth2-jpeg2000
index d0df0099ea..b60307d5da 100644
--- a/tests/ref/vsynth/vsynth2-jpeg2000
+++ b/tests/ref/vsynth/vsynth2-jpeg2000
@@ -1,4 +1,4 @@
-8c8a68ca748190c71b3ea43e5ab7f502 *tests/data/fate/vsynth2-jpeg2000.avi
-1538736 tests/data/fate/vsynth2-jpeg2000.avi
+bfe90391779a02319aab98b06dd18e6c *tests/data/fate/vsynth2-jpeg2000.avi
+1538724 tests/data/fate/vsynth2-jpeg2000.avi
 64fadc87447268cf90503cb294db7f61 *tests/data/fate/vsynth2-jpeg2000.out.rawvideo
 stddev:4.91 PSNR: 34.29 MAXDIFF:   55 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-jpeg2000-97 
b/tests/ref/vsynth/vsynth2-jpeg2000-97
index 33c1fb2425..591f8b6bb3 100644
--- a/tests/ref/vsynth/vsynth2-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth2-jpeg2000-97
@@ -1,4 +1,4 @@
-c8f76055f59804ca72dbd66eb4db83a2 *tests/data/fate/vsynth2-jpeg2000-97.avi
-2464138 tests/data/fate/vsynth2-jpeg2000-97.avi
+aa5573136c54b1855d8d00efe2a149bd *tests/data/fate/vsynth2-jpeg2000-97.avi
+2464134 tests/data/fate/vsynth2-jpeg2000-97.avi
 1f63c8b065e847e4c63d57ce23442ea8 
*tests/data/fate/vsynth2-jpeg2000-97.out.rawvideo
 stddev:3.21 PSNR: 37.99 MAXDIFF:   26 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth3-jpeg2000 
b/tests/ref/vsynth/vsynth3-jpeg2000
index ecc286b9a4..894dba27dc 100644
--- a/tests/ref/vsynth/vsynth3-jpeg2000
+++ b/tests/ref/vsynth/vsynth3-jpeg2000
@@ -1,4 +1,4 @@
-776bf3234cbf25002f129b89baab42ea *tests/data/fate/vsynth3-jpeg2000.avi
-67400 tests/data/fate/vsynth3-jpeg2000.avi
+1d039969504abdc143b410f99b5f9171 *tests/data/fate/vsynth3-jpeg2000.avi
+67354 tests/data/fate/vsynth3-jpeg2000.avi
 098f5980667e1fcd50452b1dc1a74f61 *tests/data/fate/vsynth3-jpeg2000.out.rawvideo
 stddev:5.47 PSNR: 33.36 MAXDIFF:   48 bytes:86700/86700
diff --git a/tests/ref/vsynth/vsynth3-jpeg2000-97 
b/tests/ref/vsynth/vsynth3-jpeg2000-97
index df10f43270..5d9d083791 100644
--- a/tests/ref/vsynth/vsynth3-jpeg2000-97
+++ b/tests/ref/vsynth/vsynth3-jpeg2000-97
@@ -1,4 +1,4 @@
-cd023db503f03ef72dd83e4617a90c7b *tests/data/fate/vsynth3-jpeg2000-97.avi
-85606 tests/data/fate/vsynth3-jpeg2000-97.avi
+522e12684aca4262a9d613cb2db7006c *tests/data/fate/vsynth3-jpeg2000-97.avi
+85526 tests/data/fate/vsynth3-jpeg2000-97.avi
 8def36ad1413ab3a5c2af2e1af4603f9 
*tests/data/fate/vsynth3-jpeg2000-97.out.rawvideo
 stddev:4.51 PSNR: 35.04 MAXDIFF:   47 bytes:86700/86700
diff --git a/tests/ref/vsynth/vsynth_lena-jpeg2000 
b/tests/ref/vsynth/vsynth_lena-jpeg2000
index 88629add21..e2cbc899d3 100644
--- a/tests/ref/vsynth/vsynth_lena-jpeg2000
+++ b/tests/ref/vsynth/vsynth_lena-jpeg2000
@@ -1,4 +1,4 @@
-b8aaa45236f77a2a626791d462fd8ac1 *tests/data/fate/vsynth_lena-jpeg2000.avi
-116 tests/data/fate/vsynth_lena-jpeg2000.avi
+51f061731d7fb987ff4e71789785225e *tests/data/fate/vsynth_lena-jpeg2000.avi

[FFmpeg-cvslog] configure: update copyright year

2023-10-29 Thread Lynne
ffmpeg | branch: release/5.1 | Lynne  | Sun Jan  1 00:00:00 2023 
+0100| [dad04e27b000f649ed4afd00252b07d1d5b49b7e] | committer: Michael 
Niedermayer

configure: update copyright year

(cherry picked from commit 62da0b4a741a064f118a0eece496d6bcc437ec91)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dad04e27b000f649ed4afd00252b07d1d5b49b7e
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index ba5793b2ff..6629783f34 100755
--- a/configure
+++ b/configure
@@ -7783,7 +7783,7 @@ cat > $TMPH 

[FFmpeg-cvslog] avcodec/vp3: Check width to avoid assertion failure

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Mar 26 22:35:50 2023 +0200| [f34fe6b4a4fd6123f1ea3dcc7210424ba9b769ee] | 
committer: Michael Niedermayer

avcodec/vp3: Check width to avoid assertion failure

Fixes: Assertion failure on x86-32
   av_assert2(block_w * sizeof(pixel) <= FFABS(buf_linesize)); in 
ff_emulated_edge_mc()
Fixes: 
39641/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-5925660741206016

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit dab1cd2dc0471d497f481736059b2023c5b7986a)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f34fe6b4a4fd6123f1ea3dcc7210424ba9b769ee
---

 libavcodec/vp3.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 8ca1b0dfe3..e6505df01c 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2353,6 +2353,8 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
 s->avctx  = avctx;
 s->width  = FFALIGN(avctx->coded_width, 16);
 s->height = FFALIGN(avctx->coded_height, 16);
+if (s->width < 18)
+return AVERROR_PATCHWELCOME;
 if (avctx->codec_id != AV_CODEC_ID_THEORA)
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
@@ -2919,7 +2921,9 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 /* sanity check */
 if (av_image_check_size(visible_width, visible_height, 0, avctx) < 0 ||
 visible_width  + offset_x > s->width ||
-visible_height + offset_y > s->height) {
+visible_height + offset_y > s->height ||
+visible_width < 18
+) {
 av_log(avctx, AV_LOG_ERROR,
"Invalid frame dimensions - w:%d h:%d x:%d y:%d (%dx%d).\n",
visible_width, visible_height, offset_x, offset_y,
@@ -2965,6 +2969,8 @@ static int theora_decode_header(AVCodecContext *avctx, 
GetBitContext *gb)
 } else
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 
+if (s->width < 18)
+return AVERROR_PATCHWELCOME;
 ret = ff_set_dimensions(avctx, s->width, s->height);
 if (ret < 0)
 return ret;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/g729postfilter: Limit shift in long term filter

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Mar 26 21:34:03 2023 +0200| [538f355b9abd67ebe7716dba36bdd832e21c1a82] | 
committer: Michael Niedermayer

avcodec/g729postfilter: Limit shift in long term filter

Fixes: shift exponent 34 is too large for 32-bit type 'int'
Fixes: 
57389/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6229522659016704

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
(cherry picked from commit 6d1d8609ac1054017ea3d11b325ed94a1205e9fd)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=538f355b9abd67ebe7716dba36bdd832e21c1a82
---

 libavcodec/g729postfilter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index f3cacbac05..26e937f0ba 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -353,7 +353,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int 
pitch_delay_int,
 if (tmp > 0)
 L_temp0 >>= tmp;
 else
-L_temp1 >>= -tmp;
+L_temp1 >>= FFMIN(-tmp, 31);
 
 /* Check if longer filter increases the values of R'(k). */
 if (L_temp1 > L_temp0) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] Changelog: Add forgotten line

2023-10-29 Thread Michael Niedermayer
ffmpeg | branch: release/5.1 | Michael Niedermayer  | 
Sun Mar 26 18:08:24 2023 +0200| [af1f71cfd3ee2ef6bd17da7ff1f7d3caa6facc89] | 
committer: Michael Niedermayer

Changelog: Add forgotten line

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af1f71cfd3ee2ef6bd17da7ff1f7d3caa6facc89
---

 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index b0d482a35b..9a132bc1bf 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version 5.1.3:
 - avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches
 - avcodec/snowenc: Fix visual weight calculation
 - avcodec/tests/snowenc: unbreak DWT tests
+- avfilter/vf_untile: swap the chroma shift values used for plane offsets
 - update for 5.1.3
 - avcodec/mpeg12dec: Check input size
 - avcodec/escape124: Fix some return codes

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavcodec/mpeg12: Reindent

2023-10-29 Thread Kieran Kunhya
ffmpeg | branch: master | Kieran Kunhya  | Sun Oct 29 21:53:07 
2023 +| [2532e832d2773d9d09574434f84decebcf6f81a1] | committer: Kieran 
Kunhya

libavcodec/mpeg12: Reindent

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2532e832d2773d9d09574434f84decebcf6f81a1
---

 libavcodec/mpeg12dec.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index d266dfcef3..982c25c3fd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -527,9 +527,9 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 s->mb_intra = 1;
 
 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
-for (i = 0; i < mb_block_count; i++)
-if ((ret = mpeg2_decode_block_intra(s, *s->pblocks[i], i)) 
< 0)
-return ret;
+for (i = 0; i < mb_block_count; i++)
+if ((ret = mpeg2_decode_block_intra(s, *s->pblocks[i], i)) < 0)
+return ret;
 } else {
 for (i = 0; i < 6; i++) {
 ret = ff_mpeg1_decode_block_intra(>gb,
@@ -749,27 +749,27 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 }
 
 if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
-cbp <<= 12 - mb_block_count;
+cbp <<= 12 - mb_block_count;
 
-for (i = 0; i < mb_block_count; i++) {
-if (cbp & (1 << 11)) {
-if ((ret = mpeg2_decode_block_non_intra(s, 
*s->pblocks[i], i)) < 0)
-return ret;
-} else {
-s->block_last_index[i] = -1;
-}
-cbp += cbp;
+for (i = 0; i < mb_block_count; i++) {
+if (cbp & (1 << 11)) {
+if ((ret = mpeg2_decode_block_non_intra(s, 
*s->pblocks[i], i)) < 0)
+return ret;
+} else {
+s->block_last_index[i] = -1;
 }
+cbp += cbp;
+}
 } else {
-for (i = 0; i < 6; i++) {
-if (cbp & 32) {
-if ((ret = mpeg1_decode_block_inter(s, 
*s->pblocks[i], i)) < 0)
-return ret;
-} else {
-s->block_last_index[i] = -1;
-}
-cbp += cbp;
+for (i = 0; i < 6; i++) {
+if (cbp & 32) {
+if ((ret = mpeg1_decode_block_inter(s, *s->pblocks[i], 
i)) < 0)
+return ret;
+} else {
+s->block_last_index[i] = -1;
 }
+cbp += cbp;
+}
 }
 } else {
 for (i = 0; i < 12; i++)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] libavcodec/mpeg12: Remove "fast" mode

2023-10-29 Thread Kieran Kunhya
ffmpeg | branch: master | Kieran Kunhya  | Sun Oct 29 15:32:49 
2023 +| [7d497a1119b1525c32fa0a342329898e7c3f5373] | committer: Kieran 
Kunhya

libavcodec/mpeg12: Remove "fast" mode

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d497a1119b1525c32fa0a342329898e7c3f5373
---

 libavcodec/mpeg12dec.c | 265 -
 1 file changed, 265 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 5dac83ebcd..d266dfcef3 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -233,94 +233,6 @@ end:
 return 0;
 }
 
-/**
- * Changing this would eat up any speed benefits it has.
- * Do not use "fast" flag if you need the code to be robust.
- */
-static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s,
-int16_t *block, int n)
-{
-int level, i, j, run;
-uint8_t *const scantable = s->intra_scantable.permutated;
-const int qscale = s->qscale;
-
-{
-OPEN_READER(re, >gb);
-i = -1;
-// Special case for first coefficient, no need to add second VLC table.
-UPDATE_CACHE(re, >gb);
-if (((int32_t) GET_CACHE(re, >gb)) < 0) {
-level = (3 * qscale) >> 1;
-level = (level - 1) | 1;
-if (GET_CACHE(re, >gb) & 0x4000)
-level = -level;
-block[0] = level;
-i++;
-SKIP_BITS(re, >gb, 2);
-if (((int32_t) GET_CACHE(re, >gb)) <= (int32_t) 0xBFFF)
-goto end;
-}
-
-/* now quantify & encode AC coefficients */
-for (;;) {
-GET_RL_VLC(level, run, re, >gb, ff_mpeg1_rl_vlc,
-   TEX_VLC_BITS, 2, 0);
-
-if (level != 0) {
-i += run;
-if (i > MAX_INDEX)
-break;
-j = scantable[i];
-level = ((level * 2 + 1) * qscale) >> 1;
-level = (level - 1) | 1;
-level = (level ^ SHOW_SBITS(re, >gb, 1)) -
-SHOW_SBITS(re, >gb, 1);
-SKIP_BITS(re, >gb, 1);
-} else {
-/* escape */
-run = SHOW_UBITS(re, >gb, 6) + 1;
-LAST_SKIP_BITS(re, >gb, 6);
-UPDATE_CACHE(re, >gb);
-level = SHOW_SBITS(re, >gb, 8);
-SKIP_BITS(re, >gb, 8);
-if (level == -128) {
-level = SHOW_UBITS(re, >gb, 8) - 256;
-SKIP_BITS(re, >gb, 8);
-} else if (level == 0) {
-level = SHOW_UBITS(re, >gb, 8);
-SKIP_BITS(re, >gb, 8);
-}
-i += run;
-if (i > MAX_INDEX)
-break;
-j = scantable[i];
-if (level < 0) {
-level = -level;
-level = ((level * 2 + 1) * qscale) >> 1;
-level = (level - 1) | 1;
-level = -level;
-} else {
-level = ((level * 2 + 1) * qscale) >> 1;
-level = (level - 1) | 1;
-}
-}
-
-block[j] = level;
-if (((int32_t) GET_CACHE(re, >gb)) <= (int32_t) 0xBFFF)
-break;
-UPDATE_CACHE(re, >gb);
-}
-end:
-LAST_SKIP_BITS(re, >gb, 2);
-CLOSE_READER(re, >gb);
-}
-
-check_scantable_index(s, i);
-
-s->block_last_index[n] = i;
-return 0;
-}
-
 static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
int16_t *block, int n)
 {
@@ -406,81 +318,6 @@ end:
 return 0;
 }
 
-/**
- * Changing this would eat up any speed benefits it has.
- * Do not use "fast" flag if you need the code to be robust.
- */
-static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
-int16_t *block, int n)
-{
-int level, i, j, run;
-uint8_t *const scantable = s->intra_scantable.permutated;
-const int qscale = s->qscale;
-OPEN_READER(re, >gb);
-i = -1;
-
-// special case for first coefficient, no need to add second VLC table
-UPDATE_CACHE(re, >gb);
-if (((int32_t) GET_CACHE(re, >gb)) < 0) {
-level = (3 * qscale) >> 1;
-if (GET_CACHE(re, >gb) & 0x4000)
-level = -level;
-block[0] = level;
-i++;
-SKIP_BITS(re, >gb, 2);
-if (((int32_t) GET_CACHE(re, >gb)) <= (int32_t) 0xBFFF)
-goto end;
-}
-
-/* now quantify & encode AC coefficients */
-for (;;) {
-GET_RL_VLC(level, run, re, >gb, ff_mpeg1_rl_vlc, TEX_VLC_BITS, 2, 
0);
-
-if (level != 0) {
-i += run;
-if (i > MAX_INDEX)
-break;
-j = scantable[i];
-

[FFmpeg-cvslog] lavu/riscv: fix typo

2023-10-29 Thread Rémi Denis-Courmont
ffmpeg | branch: master | Rémi Denis-Courmont  | Thu Oct 26 
19:04:27 2023 +0300| [04b49fb3c5ad01c91e6724bac1b68e4b47a72c29] | committer: 
Rémi Denis-Courmont

lavu/riscv: fix typo

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04b49fb3c5ad01c91e6724bac1b68e4b47a72c29
---

 libavutil/riscv/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/riscv/cpu.c b/libavutil/riscv/cpu.c
index fa45c0ad83..460d3e9f91 100644
--- a/libavutil/riscv/cpu.c
+++ b/libavutil/riscv/cpu.c
@@ -67,7 +67,7 @@ int ff_get_cpu_flags_riscv(void)
 #endif
 
 /* If RV-V is enabled statically at compile-time, check the details. */
-#ifdef __riscv_vectors
+#ifdef __riscv_vector
 ret |= AV_CPU_FLAG_RVV_I32;
 #if __riscv_v_elen >= 64
 ret |= AV_CPU_FLAG_RVV_I64;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/libaribcaption: add MSZ character related options

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: release/6.1 | TADANO Tokumei  | Tue Oct 
17 22:13:34 2023 +0900| [8ccd1593a4b8c715d6fb3f8eaea630dbf2518569] | committer: 
Jan Ekström

lavc/libaribcaption: add MSZ character related options

This patch adds two MSZ (Middle Size; half width) character
related options, mapping against newly added upstream
functionality:

* `replace_msz_japanese`, which was introduced in version 1.0.1
  of libaribcaption.
* `replace_msz_glyph`, which was introduced in version 1.1.0
  of libaribcaption.

The latter option improves bitmap type rendering if specified
fonts contain half-width glyphs (e.g., BIZ UDGothic), even
if both ASCII and Japanese MSZ replacement options are set
to false.

As these options require newer versions of libaribcaption, the
configure requirement has been bumped accordingly.

Signed-off-by: TADANO Tokumei 
(cherry picked from commit 21bfadd9b4a216c0b0994465325822d554fc6a52)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ccd1593a4b8c715d6fb3f8eaea630dbf2518569
---

 configure   |  2 +-
 doc/decoders.texi   | 16 
 libavcodec/libaribcaption.c | 10 ++
 libavcodec/version.h|  2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f494da204c..1f0b9497cb 100755
--- a/configure
+++ b/configure
@@ -6677,7 +6677,7 @@ enabled libaom&& require_pkg_config libaom 
"aom >= 1.0.0" aom/aom_co
 enabled libaribb24&& { check_pkg_config libaribb24 "aribb24 > 1.0.3" 
"aribb24/aribb24.h" arib_instance_new ||
{ enabled gpl && require_pkg_config libaribb24 
aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
die "ERROR: libaribb24 requires version higher 
than 1.0.3 or --enable-gpl."; }
-enabled libaribcaption&& require_pkg_config libaribcaption "libaribcaption 
>= 0.1.0" "aribcaption/aribcaption.h" aribcc_context_alloc
+enabled libaribcaption&& require_pkg_config libaribcaption "libaribcaption 
>= 1.1.1" "aribcaption/aribcaption.h" aribcc_context_alloc
 enabled lv2   && require_pkg_config lv2 lilv-0 "lilv/lilv.h" 
lilv_world_new
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass&& require_pkg_config libass "libass >= 0.11.0" 
ass/ass.h ass_library_init
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 09b8314dd2..36c3404475 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -459,6 +459,22 @@ Specify whether to render replaced DRCS characters as 
Unicode characters.
 
 The default is @var{true}.
 
+@item -replace_msz_japanese @var{boolean}
+Specify whether to replace some MSZ (Middle Size; half width) fullwidth
+japanese special characters with halfwidth ones.
+
+The default is @var{true}.
+
+@item -replace_msz_glyph @var{boolean}
+Specify whether to replace MSZ (Middle Size; half width) characters
+with halfwidth glyphs if the fonts supports it.
+This option works under FreeType or DirectWrite renderer
+with Adobe-Japan1 compliant fonts.
+e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
+Yu Gothic, Yu Mincho, and Meiryo.
+
+The default is @var{true}.
+
 @item -canvas_size @var{image_size}
 Specify the resolution of the canvas to render subtitles to; usually, this
 should be frame size of input video.
diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index be3328c5c9..29642cd817 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -76,6 +76,8 @@ typedef struct ARIBCaptionContext {
 int ignore_ruby;
 float stroke_width;
 int replace_drcs;
+int replace_msz_japanese;
+int replace_msz_glyph;
 
 int64_t pts;
 AVRational time_base;
@@ -1005,6 +1007,8 @@ static int aribcaption_init(AVCodecContext *avctx)
 }
 aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder,

ctx->replace_fullwidth_ascii);
+aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder,
+  
ctx->replace_msz_japanese);
 
 /* Similar behavior as ffmpeg tool to set canvas size */
 if (ctx->canvas_width > 0 && ctx->canvas_height > 0 &&
@@ -1057,6 +1061,8 @@ static int aribcaption_init(AVCodecContext *avctx)
 aribcc_renderer_set_force_no_background(ctx->renderer, 
ctx->ignore_background);
 aribcc_renderer_set_force_no_ruby(ctx->renderer, ctx->ignore_ruby);
 aribcc_renderer_set_stroke_width(ctx->renderer, ctx->stroke_width);
+aribcc_renderer_set_replace_msz_halfwidth_glyph(ctx->renderer,
+
ctx->replace_msz_glyph);
 if (ctx->font) {
 int is_nomem = 0;
 size_t count = 0;
@@ -1144,6 +1150,10 @@ static const AVOption options[] = {
   OFFSET(stroke_width), 

[FFmpeg-cvslog] lavc/libaribcaption: rename `replace_fullwidth_ascii` to `replace_msz_ascii`

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: release/6.1 | TADANO Tokumei  | Tue Oct 
17 22:13:35 2023 +0900| [1cff6e41bf2b8a53ebba516dde9f592c63581f14] | committer: 
Jan Ekström

lavc/libaribcaption: rename `replace_fullwidth_ascii` to `replace_msz_ascii`

This should hopefully clarify that the option only affects MSZ
full-width characters, and not all full-width ASCII. Additionally,
this matches the prefix with the upstream option.

Signed-off-by: TADANO Tokumei 
(cherry picked from commit a824c6f2f627474b4fc9044c3d43297c9767b758)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1cff6e41bf2b8a53ebba516dde9f592c63581f14
---

 doc/decoders.texi   | 12 ++--
 libavcodec/libaribcaption.c |  8 
 libavcodec/version.h|  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 36c3404475..eb00e2a9e9 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -427,12 +427,6 @@ If your player cannot handle AVSubtitles with multiple ASS 
rectangles properly,
 set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
 default behavior at compilation.
 
-@item -replace_fullwidth_ascii @var{boolean}
-Specify whether to replace MSZ (Middle Size, half width) fullwidth
-alphanumerics with halfwidth alphanumerics.
-
-The default is @var{true}.
-
 @item -force_outline_text @var{boolean}
 Specify whether always render outline text for all characters regardless of
 the indication by charactor style.
@@ -459,6 +453,12 @@ Specify whether to render replaced DRCS characters as 
Unicode characters.
 
 The default is @var{true}.
 
+@item -replace_msz_ascii @var{boolean}
+Specify whether to replace MSZ (Middle Size; half width) fullwidth
+alphanumerics with halfwidth alphanumerics.
+
+The default is @var{true}.
+
 @item -replace_msz_japanese @var{boolean}
 Specify whether to replace some MSZ (Middle Size; half width) fullwidth
 japanese special characters with halfwidth ones.
diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 29642cd817..e87f303aa8 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -70,12 +70,12 @@ typedef struct ARIBCaptionContext {
 int encoding_scheme;
 int ass_single_rect;
 char *font;
-int replace_fullwidth_ascii;
 int force_stroke_text;
 int ignore_background;
 int ignore_ruby;
 float stroke_width;
 int replace_drcs;
+int replace_msz_ascii;
 int replace_msz_japanese;
 int replace_msz_glyph;
 
@@ -1006,7 +1006,7 @@ static int aribcaption_init(AVCodecContext *avctx)
 return AVERROR_EXTERNAL;
 }
 aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder,
-   
ctx->replace_fullwidth_ascii);
+   ctx->replace_msz_ascii);
 aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder,
   
ctx->replace_msz_japanese);
 
@@ -1138,8 +1138,6 @@ static const AVOption options[] = {
   OFFSET(ass_single_rect), AV_OPT_TYPE_BOOL, { .i64 = ASS_SINGLE_RECT }, 
0, 1, SD },
 { "font", "comma-separated font family [ass, bitmap]",
   OFFSET(font), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
-{ "replace_fullwidth_ascii", "replace MSZ fullwidth alphanumerics with 
halfwidth alphanumerics [ass, bitmap]",
-  OFFSET(replace_fullwidth_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, 
SD },
 { "force_outline_text", "always render characters with outline [(ass), 
bitmap]",
   OFFSET(force_stroke_text), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, SD },
 { "ignore_background", "ignore rendering caption background [(ass), 
bitmap]",
@@ -1150,6 +1148,8 @@ static const AVOption options[] = {
   OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD },
 { "replace_drcs", "replace known DRCS [bitmap]",
   OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
+{ "replace_msz_ascii", "replace MSZ fullwidth alphanumerics with halfwidth 
alphanumerics [ass, bitmap]",
+  OFFSET(replace_msz_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
 { "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth 
[ass, bitmap]",
   OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
 { "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs 
[bitmap]",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1030154c0e..1cf9651391 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 #include "version_major.h"
 
 #define LIBAVCODEC_VERSION_MINOR  31
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

___
ffmpeg-cvslog mailing 

[FFmpeg-cvslog] lavc/libaribcaption: switch all `bool` context variables to `int`

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: release/6.1 | TADANO Tokumei  | Tue Oct 
17 22:13:33 2023 +0900| [48afb43549024eff7ad107515763a6ec9f3a2ee8] | committer: 
Jan Ekström

lavc/libaribcaption: switch all `bool` context variables to `int`

On some environments, a `bool` variable is of smaller size than `int`.
As AV_OPT_TYPE_BOOL is internally handled as sizeof(int), if a `bool`
option was set on such an environment, the memory of following
variables would be filled. Additionally, set values may be destroyed
by av_opt_copy().

Signed-off-by: TADANO Tokumei 
(cherry picked from commit 82faba8a6ce8b6a9a3db635ce0a70495a2b2cf3c)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=48afb43549024eff7ad107515763a6ec9f3a2ee8
---

 libavcodec/libaribcaption.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 8a8c8f8cfd..be3328c5c9 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -68,14 +68,14 @@ typedef struct ARIBCaptionContext {
 
 int subtitle_type;
 int encoding_scheme;
-bool ass_single_rect;
+int ass_single_rect;
 char *font;
-bool replace_fullwidth_ascii;
-bool force_stroke_text;
-bool ignore_background;
-bool ignore_ruby;
+int replace_fullwidth_ascii;
+int force_stroke_text;
+int ignore_background;
+int ignore_ruby;
 float stroke_width;
-bool replace_drcs;
+int replace_drcs;
 
 int64_t pts;
 AVRational time_base;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/libaribcaption: rename `replace_fullwidth_ascii` to `replace_msz_ascii`

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: master | TADANO Tokumei  | Tue Oct 17 
22:13:35 2023 +0900| [a824c6f2f627474b4fc9044c3d43297c9767b758] | committer: 
Jan Ekström

lavc/libaribcaption: rename `replace_fullwidth_ascii` to `replace_msz_ascii`

This should hopefully clarify that the option only affects MSZ
full-width characters, and not all full-width ASCII. Additionally,
this matches the prefix with the upstream option.

Signed-off-by: TADANO Tokumei 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a824c6f2f627474b4fc9044c3d43297c9767b758
---

 doc/decoders.texi   | 12 ++--
 libavcodec/libaribcaption.c |  8 
 libavcodec/version.h|  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 36c3404475..eb00e2a9e9 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -427,12 +427,6 @@ If your player cannot handle AVSubtitles with multiple ASS 
rectangles properly,
 set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change
 default behavior at compilation.
 
-@item -replace_fullwidth_ascii @var{boolean}
-Specify whether to replace MSZ (Middle Size, half width) fullwidth
-alphanumerics with halfwidth alphanumerics.
-
-The default is @var{true}.
-
 @item -force_outline_text @var{boolean}
 Specify whether always render outline text for all characters regardless of
 the indication by charactor style.
@@ -459,6 +453,12 @@ Specify whether to render replaced DRCS characters as 
Unicode characters.
 
 The default is @var{true}.
 
+@item -replace_msz_ascii @var{boolean}
+Specify whether to replace MSZ (Middle Size; half width) fullwidth
+alphanumerics with halfwidth alphanumerics.
+
+The default is @var{true}.
+
 @item -replace_msz_japanese @var{boolean}
 Specify whether to replace some MSZ (Middle Size; half width) fullwidth
 japanese special characters with halfwidth ones.
diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 29642cd817..e87f303aa8 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -70,12 +70,12 @@ typedef struct ARIBCaptionContext {
 int encoding_scheme;
 int ass_single_rect;
 char *font;
-int replace_fullwidth_ascii;
 int force_stroke_text;
 int ignore_background;
 int ignore_ruby;
 float stroke_width;
 int replace_drcs;
+int replace_msz_ascii;
 int replace_msz_japanese;
 int replace_msz_glyph;
 
@@ -1006,7 +1006,7 @@ static int aribcaption_init(AVCodecContext *avctx)
 return AVERROR_EXTERNAL;
 }
 aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder,
-   
ctx->replace_fullwidth_ascii);
+   ctx->replace_msz_ascii);
 aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder,
   
ctx->replace_msz_japanese);
 
@@ -1138,8 +1138,6 @@ static const AVOption options[] = {
   OFFSET(ass_single_rect), AV_OPT_TYPE_BOOL, { .i64 = ASS_SINGLE_RECT }, 
0, 1, SD },
 { "font", "comma-separated font family [ass, bitmap]",
   OFFSET(font), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
-{ "replace_fullwidth_ascii", "replace MSZ fullwidth alphanumerics with 
halfwidth alphanumerics [ass, bitmap]",
-  OFFSET(replace_fullwidth_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, 
SD },
 { "force_outline_text", "always render characters with outline [(ass), 
bitmap]",
   OFFSET(force_stroke_text), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, SD },
 { "ignore_background", "ignore rendering caption background [(ass), 
bitmap]",
@@ -1150,6 +1148,8 @@ static const AVOption options[] = {
   OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD },
 { "replace_drcs", "replace known DRCS [bitmap]",
   OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
+{ "replace_msz_ascii", "replace MSZ fullwidth alphanumerics with halfwidth 
alphanumerics [ass, bitmap]",
+  OFFSET(replace_msz_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
 { "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth 
[ass, bitmap]",
   OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
 { "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs 
[bitmap]",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 02192c86f7..d6f1440d54 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 #include "version_major.h"
 
 #define LIBAVCODEC_VERSION_MINOR  32
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org

[FFmpeg-cvslog] lavc/libaribcaption: add MSZ character related options

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: master | TADANO Tokumei  | Tue Oct 17 
22:13:34 2023 +0900| [21bfadd9b4a216c0b0994465325822d554fc6a52] | committer: 
Jan Ekström

lavc/libaribcaption: add MSZ character related options

This patch adds two MSZ (Middle Size; half width) character
related options, mapping against newly added upstream
functionality:

* `replace_msz_japanese`, which was introduced in version 1.0.1
  of libaribcaption.
* `replace_msz_glyph`, which was introduced in version 1.1.0
  of libaribcaption.

The latter option improves bitmap type rendering if specified
fonts contain half-width glyphs (e.g., BIZ UDGothic), even
if both ASCII and Japanese MSZ replacement options are set
to false.

As these options require newer versions of libaribcaption, the
configure requirement has been bumped accordingly.

Signed-off-by: TADANO Tokumei 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21bfadd9b4a216c0b0994465325822d554fc6a52
---

 configure   |  2 +-
 doc/decoders.texi   | 16 
 libavcodec/libaribcaption.c | 10 ++
 libavcodec/version.h|  2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f494da204c..1f0b9497cb 100755
--- a/configure
+++ b/configure
@@ -6677,7 +6677,7 @@ enabled libaom&& require_pkg_config libaom 
"aom >= 1.0.0" aom/aom_co
 enabled libaribb24&& { check_pkg_config libaribb24 "aribb24 > 1.0.3" 
"aribb24/aribb24.h" arib_instance_new ||
{ enabled gpl && require_pkg_config libaribb24 
aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
die "ERROR: libaribb24 requires version higher 
than 1.0.3 or --enable-gpl."; }
-enabled libaribcaption&& require_pkg_config libaribcaption "libaribcaption 
>= 0.1.0" "aribcaption/aribcaption.h" aribcc_context_alloc
+enabled libaribcaption&& require_pkg_config libaribcaption "libaribcaption 
>= 1.1.1" "aribcaption/aribcaption.h" aribcc_context_alloc
 enabled lv2   && require_pkg_config lv2 lilv-0 "lilv/lilv.h" 
lilv_world_new
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass&& require_pkg_config libass "libass >= 0.11.0" 
ass/ass.h ass_library_init
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 09b8314dd2..36c3404475 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -459,6 +459,22 @@ Specify whether to render replaced DRCS characters as 
Unicode characters.
 
 The default is @var{true}.
 
+@item -replace_msz_japanese @var{boolean}
+Specify whether to replace some MSZ (Middle Size; half width) fullwidth
+japanese special characters with halfwidth ones.
+
+The default is @var{true}.
+
+@item -replace_msz_glyph @var{boolean}
+Specify whether to replace MSZ (Middle Size; half width) characters
+with halfwidth glyphs if the fonts supports it.
+This option works under FreeType or DirectWrite renderer
+with Adobe-Japan1 compliant fonts.
+e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho,
+Yu Gothic, Yu Mincho, and Meiryo.
+
+The default is @var{true}.
+
 @item -canvas_size @var{image_size}
 Specify the resolution of the canvas to render subtitles to; usually, this
 should be frame size of input video.
diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index be3328c5c9..29642cd817 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -76,6 +76,8 @@ typedef struct ARIBCaptionContext {
 int ignore_ruby;
 float stroke_width;
 int replace_drcs;
+int replace_msz_japanese;
+int replace_msz_glyph;
 
 int64_t pts;
 AVRational time_base;
@@ -1005,6 +1007,8 @@ static int aribcaption_init(AVCodecContext *avctx)
 }
 aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder,

ctx->replace_fullwidth_ascii);
+aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder,
+  
ctx->replace_msz_japanese);
 
 /* Similar behavior as ffmpeg tool to set canvas size */
 if (ctx->canvas_width > 0 && ctx->canvas_height > 0 &&
@@ -1057,6 +1061,8 @@ static int aribcaption_init(AVCodecContext *avctx)
 aribcc_renderer_set_force_no_background(ctx->renderer, 
ctx->ignore_background);
 aribcc_renderer_set_force_no_ruby(ctx->renderer, ctx->ignore_ruby);
 aribcc_renderer_set_stroke_width(ctx->renderer, ctx->stroke_width);
+aribcc_renderer_set_replace_msz_halfwidth_glyph(ctx->renderer,
+
ctx->replace_msz_glyph);
 if (ctx->font) {
 int is_nomem = 0;
 size_t count = 0;
@@ -1144,6 +1150,10 @@ static const AVOption options[] = {
   OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD },
 { "replace_drcs", "replace known 

[FFmpeg-cvslog] lavc/libaribcaption: switch all `bool` context variables to `int`

2023-10-29 Thread TADANO Tokumei
ffmpeg | branch: master | TADANO Tokumei  | Tue Oct 17 
22:13:33 2023 +0900| [82faba8a6ce8b6a9a3db635ce0a70495a2b2cf3c] | committer: 
Jan Ekström

lavc/libaribcaption: switch all `bool` context variables to `int`

On some environments, a `bool` variable is of smaller size than `int`.
As AV_OPT_TYPE_BOOL is internally handled as sizeof(int), if a `bool`
option was set on such an environment, the memory of following
variables would be filled. Additionally, set values may be destroyed
by av_opt_copy().

Signed-off-by: TADANO Tokumei 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82faba8a6ce8b6a9a3db635ce0a70495a2b2cf3c
---

 libavcodec/libaribcaption.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index 8a8c8f8cfd..be3328c5c9 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -68,14 +68,14 @@ typedef struct ARIBCaptionContext {
 
 int subtitle_type;
 int encoding_scheme;
-bool ass_single_rect;
+int ass_single_rect;
 char *font;
-bool replace_fullwidth_ascii;
-bool force_stroke_text;
-bool ignore_background;
-bool ignore_ruby;
+int replace_fullwidth_ascii;
+int force_stroke_text;
+int ignore_background;
+int ignore_ruby;
 float stroke_width;
-bool replace_drcs;
+int replace_drcs;
 
 int64_t pts;
 AVRational time_base;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] Changelog: mark 6.1

2023-10-29 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Oct 29 12:53:26 
2023 -0300| [ff3429991ec1bac1d1b71215402e3d195162e125] | committer: James Almer

Changelog: mark 6.1

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff3429991ec1bac1d1b71215402e3d195162e125
---

 Changelog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index cceee46215..8f0606fc26 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
-version :
+version 6.1:
 - libaribcaption decoder
 - Playdate video decoder and demuxer
 - Extend VAAPI support for libva-win32 on Windows

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] Changelog: mark 6.0

2023-10-29 Thread James Almer
ffmpeg | branch: release/6.1 | James Almer  | Sun Oct 29 
12:53:26 2023 -0300| [5c5d3e315e802364023bb84b59087735824bbfc1] | committer: 
James Almer

Changelog: mark 6.0

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c5d3e315e802364023bb84b59087735824bbfc1
---

 Changelog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index cceee46215..8f0606fc26 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,7 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
-version :
+version 6.1:
 - libaribcaption decoder
 - Playdate video decoder and demuxer
 - Extend VAAPI support for libva-win32 on Windows

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


  1   2   >