Re: [FFmpeg-devel] [PATCH v5 0/4] Explain what "context" means

2024-05-23 Thread Michael Niedermayer
On Thu, May 23, 2024 at 09:00:39PM +0100, Andrew Sayers wrote:
> NOTE: this patchset depends on [1], and should not be applied before that.
> 
> I think it's important to guide readers between parts of FFmpeg, because
> learning how the pieces of the puzzle fit together is a big part of the
> newbie experience.  So this patchset replaces the "@ref Context for foo"
> statements in public structs with "@see" blocks, giving us a hook we can
> hang more links on in future.
> 
> That said, there's a rule against internal links from private structs,
> so I've removed the @ref's from them.  By the way, is this rule written
> somewhere?  If not, where would be a good place to write it?
> And either way, it would be good to link to this as part of [2].
> 
> Previous patches had to change the language for many structs, but "@see" 
> blocks
> avoid the need to include those changes in this patchset.  Rather than waste
> that work, I've temporarily moved those changes to the final patch in this 
> set.
> My feelings about that last patch aren't strong, but I guess I'll propose them
> in a separate thread unless anyone wants them here or chucked altogether.
> 
> 
> I've rewritten AVOptions and AVClass based on feedback.  The new version
> reflects a hypothetical that's been going round my head all week...
> 
> Imagine you wanted to write a system that nudged people to try new codecs.
> It might say e.g. "you seem to be using H.264, would you like to try H.265?"
> Implementing that would probably involve a struct like:
> 
> struct AVOldNew {
>   AVClass* old;
>   AVClass* new;
> };

AVClass would describe the internal decoder structures. This would not be
correct at all in this example.
Thats like handing a man 2 CAD documents about 2 engines of 2 cars

If you wanted to suggest to get a tesla instead of a ford. One would have to
describe the 2 cars and their differences
thats 2 AVCodecDescriptor maybe

thx

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

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 7/7] avcodec/tests/bitstream_template: Make it clear that the return is intentionally not checked

2024-05-23 Thread Michael Niedermayer
On Thu, May 23, 2024 at 10:22:56AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Helps: CID1518967 Unchecked return value
> > Helps: CID1518968 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/tests/bitstream_template.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tests/bitstream_template.c 
> > b/libavcodec/tests/bitstream_template.c
> > index ef59845154d..d8cf980bee1 100644
> > --- a/libavcodec/tests/bitstream_template.c
> > +++ b/libavcodec/tests/bitstream_template.c
> > @@ -74,7 +74,7 @@ int main(int argc, char **argv)
> >  for (unsigned i = 0; i < SIZE; i++)
> >  buf[i] = av_lfg_get();
> >  
> > -bits_init8   (, buf, SIZE);
> > +(void)bits_init8   (, buf, SIZE);
> >  init_put_bits(, dst, SIZE);
> >  
> >  /* use a random sequence of bitreading operations to transfer data
> 
> Test tools should actually test.

will replace with a assert0() then

thx

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avformat/demux: Remove dead stores

2024-05-23 Thread Michael Niedermayer
Fixes: CID1473512 Unused value
Fixes: CID1529228 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavformat/demux.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index ecefe7e0a74..d0a5a39d052 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2998,9 +2998,6 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 
 av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
 
-if (ret >= 0 && ic->nb_streams)
-/* We could not have all the codec parameters before EOF. */
-ret = -1;
 for (unsigned i = 0; i < ic->nb_streams; i++) {
 AVStream *const st  = ic->streams[i];
 FFStream *const sti = ffstream(st);
@@ -3022,8 +3019,6 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
"Could not find codec parameters for stream %d (%s): %s\n"
"Consider increasing the value for the 'analyzeduration' 
(%"PRId64") and 'probesize' (%"PRId64") options\n",
i, buf, errmsg, ic->max_analyze_duration, ic->probesize);
-} else {
-ret = 0;
 }
 }
 
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 7/7] avcodec/tests/bitstream_template: Make it clear that the return is intentionally not checked

2024-05-22 Thread Michael Niedermayer
Helps: CID1518967 Unchecked return value
Helps: CID1518968 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tests/bitstream_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tests/bitstream_template.c 
b/libavcodec/tests/bitstream_template.c
index ef59845154d..d8cf980bee1 100644
--- a/libavcodec/tests/bitstream_template.c
+++ b/libavcodec/tests/bitstream_template.c
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
 for (unsigned i = 0; i < SIZE; i++)
 buf[i] = av_lfg_get();
 
-bits_init8   (, buf, SIZE);
+(void)bits_init8   (, buf, SIZE);
 init_put_bits(, dst, SIZE);
 
 /* use a random sequence of bitreading operations to transfer data
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 6/7] avcodec/sga: Make it clear that the return is intentionally not checked

2024-05-22 Thread Michael Niedermayer
Related: CID1473496 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/sga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 0f42cf912b2..618df000ada 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -73,7 +73,7 @@ static int decode_palette(GetByteContext *gb, uint32_t *pal)
 return AVERROR_INVALIDDATA;
 
 memset(pal, 0, 16 * sizeof(*pal));
-init_get_bits8(, gb->buffer, 18);
+(void)init_get_bits8(, gb->buffer, 18);
 
 for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
 for (int index = 0; index < 16; index++) {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 5/7] avformat/asfdec_f: Use 64bit for preroll computation

2024-05-22 Thread Michael Niedermayer
Fixes: CID1500342 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 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 fcc2b98a2c4..2441cadb444 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -675,7 +675,7 @@ static int asf_read_marker(AVFormatContext *s)
 
 avio_rl64(pb); // offset, 8 bytes
 pres_time = avio_rl64(pb); // presentation time
-pres_time = av_sat_sub64(pres_time, asf->hdr.preroll * 1);
+pres_time = av_sat_sub64(pres_time, asf->hdr.preroll * 1LL);
 avio_rl16(pb); // entry length
 avio_rl32(pb); // send time
 avio_rl32(pb); // flags
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 4/7] avformat/argo_asf: Use 64bit in offset intermediate

2024-05-22 Thread Michael Niedermayer
Fixes: CID1467435 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavformat/argo_asf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 61bfc6de1fc..e08f029f80c 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -259,7 +259,7 @@ static int argo_asf_seek(AVFormatContext *s, int 
stream_index,
 return -1;
 
 offset = asf->fhdr.chunk_offset + ASF_CHUNK_HEADER_SIZE +
- (block * st->codecpar->block_align);
+ block * (int64_t)st->codecpar->block_align;
 
 if ((offset = avio_seek(s->pb, offset, SEEK_SET)) < 0)
 return offset;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 3/7] avformat/ape: Use 64bit for final frame size

2024-05-22 Thread Michael Niedermayer
Fixes: CID1505963 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavformat/ape.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/ape.c b/libavformat/ape.c
index c0e3e9f4fe6..f86ca5e894c 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -292,7 +292,7 @@ static int ape_read_header(AVFormatContext * s)
 final_size -= final_size & 3;
 }
 if (file_size <= 0 || final_size <= 0)
-final_size = ape->finalframeblocks * 8;
+final_size = ape->finalframeblocks * 8LL;
 ape->frames[ape->totalframes - 1].size = final_size;
 
 for (i = 0; i < ape->totalframes; i++) {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 2/7] avformat/ac4dec: Check remaining space in ac4_probe()

2024-05-22 Thread Michael Niedermayer
Fixes: CID1538298 Untrusted loop bound
Fixes: undefined behavior

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavformat/ac4dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/ac4dec.c b/libavformat/ac4dec.c
index f647f557ccd..dc6638de3a4 100644
--- a/libavformat/ac4dec.c
+++ b/libavformat/ac4dec.c
@@ -43,6 +43,8 @@ static int ac4_probe(const AVProbeData *p)
 size += 4;
 if (buf[1] == 0x41)
 size += 2;
+if (left < size)
+break;
 max_frames++;
 left -= size;
 buf += size;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 1/7] avdevice/pulse_audio_enc: Use av_rescale() to avoid integer overflow

2024-05-22 Thread Michael Niedermayer
Fixes: CID1503075 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavdevice/pulse_audio_enc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavdevice/pulse_audio_enc.c b/libavdevice/pulse_audio_enc.c
index 3e2cc91f697..80136d1e20c 100644
--- a/libavdevice/pulse_audio_enc.c
+++ b/libavdevice/pulse_audio_enc.c
@@ -471,10 +471,11 @@ static av_cold int pulse_write_header(AVFormatContext *h)
 s->nonblocking = (h->flags & AVFMT_FLAG_NONBLOCK);
 
 if (s->buffer_duration) {
-int64_t bytes = s->buffer_duration;
-bytes *= st->codecpar->ch_layout.nb_channels * 
st->codecpar->sample_rate *
- av_get_bytes_per_sample(st->codecpar->format);
-bytes /= 1000;
+int64_t bytes = av_rescale(s->buffer_duration,
+   st->codecpar->ch_layout.nb_channels *
+(int64_t)st->codecpar->sample_rate *
+
av_get_bytes_per_sample(st->codecpar->format),
+   1000);
 buffer_attributes.tlength = FFMAX(s->buffer_size, av_clip64(bytes, 0, 
UINT32_MAX - 1));
 av_log(s, AV_LOG_DEBUG,
"Buffer duration: %ums recalculated into %"PRId64" bytes 
buffer.\n",
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH 13/13] avformat/flvdec: support all multi-track modes

2024-05-21 Thread Michael Niedermayer
On Tue, May 21, 2024 at 11:02:22AM +0200, Timo Rothenpieler wrote:
> ---
>  libavformat/flvdec.c | 570 +++
>  1 file changed, 306 insertions(+), 264 deletions(-)

infinite loops

[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 
(ffmpeg-devel@ffmpeg.org)
[flv @ 0x555e803d2940] Video codec (0) is not implemented. Update your FFmpeg 
version to the newest one from Git. If the problem still occurs, it means that 
your file has a feature which has not been implemented.
[flv @ 0x555e803d2940] If you want to help, upload a sample of this file to 
https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. 

[FFmpeg-devel] [PATCH 7/7] tools/enc_recon_frame_test: Assert that av_image_get_linesize() succeeds

2024-05-20 Thread Michael Niedermayer
Helps: CID1524598 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 tools/enc_recon_frame_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/enc_recon_frame_test.c b/tools/enc_recon_frame_test.c
index c099beb3f4b..d39d6303c2e 100644
--- a/tools/enc_recon_frame_test.c
+++ b/tools/enc_recon_frame_test.c
@@ -28,6 +28,7 @@
 #include "decode_simple.h"
 
 #include "libavutil/adler32.h"
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/error.h"
 #include "libavutil/frame.h"
@@ -89,6 +90,8 @@ static int frame_hash(FrameChecksum **pc, size_t *nb_c, 
int64_t ts,
 int linesize = av_image_get_linesize(frame->format, frame->width, p);
 uint32_t checksum = 0;
 
+av_assert1(linesize >= 0);
+
 for (int j = 0; j < frame->height >> shift_v[p]; j++) {
 checksum = av_adler32_update(checksum, data, linesize);
 data += frame->linesize[p];
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 6/7] tools/decode_simple: Check avcodec_send_packet() for errors on flushing

2024-05-20 Thread Michael Niedermayer
This will not error but the API allows errors so we should check it
Fixes: CID148 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 tools/decode_simple.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/decode_simple.c b/tools/decode_simple.c
index 6532e368d46..e8c1d6a407e 100644
--- a/tools/decode_simple.c
+++ b/tools/decode_simple.c
@@ -94,8 +94,9 @@ int ds_run(DecodeContext *dc)
 goto finish;
 }
 
-avcodec_send_packet(dc->decoder, NULL);
-ret = decode_read(dc, 1);
+ret = avcodec_send_packet(dc->decoder, NULL);
+if (ret >= 0)
+ret = decode_read(dc, 1);
 if (ret < 0) {
 fprintf(stderr, "Error flushing: %d\n", ret);
 return ret;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 5/7] swscale/yuv2rgb: Use 64bit for brightness computation

2024-05-20 Thread Michael Niedermayer
This will not overflow for normal values
Fixes: CID1500280 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libswscale/yuv2rgb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 2b2358d2cc1..c1d6236f37f 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -830,7 +830,7 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const 
int inv_table[4],
 cbu  = (cbu * contrast * saturation) >> 32;
 cgu  = (cgu * contrast * saturation) >> 32;
 cgv  = (cgv * contrast * saturation) >> 32;
-oy  -= 256 * brightness;
+oy  -= 256LL * brightness;
 
 c->uOffset = 0x0400040004000400LL;
 c->vOffset = 0x0400040004000400LL;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 4/7] swscale/x86/swscale: use a clearer name for INPUT_PLANER_RGB_A_FUNC_CASE

2024-05-20 Thread Michael Niedermayer
related: CID1497114 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libswscale/x86/swscale.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index ff16398988a..bc18f9dd08a 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -649,7 +649,7 @@ switch(c->dstBpc){ \
 }
 
 
-#define INPUT_PLANER_RGB_A_FUNC_CASE(fmt, name, opt)  \
+#define INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(fmt, name, opt)  \
 case fmt: \
 c->readAlpPlanar = ff_planar_##name##_to_a_##opt;
 
@@ -672,15 +672,15 @@ switch(c->dstBpc){ \
 break;
 
 #define INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
-INPUT_PLANER_RGB_A_FUNC_CASE(rgba_fmt##LE,  name##le, opt)   \
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE,  name##le, opt) 
  \
 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt)   \
-INPUT_PLANER_RGB_A_FUNC_CASE(rgba_fmt##BE,  name##be, opt)   \
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE,  name##be, opt) 
  \
 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
 
 #define INPUT_PLANER_RGBAXX_UVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
-INPUT_PLANER_RGB_A_FUNC_CASE(rgba_fmt##LE, name##le, opt)   \
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt)  
 \
 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt)   \
-INPUT_PLANER_RGB_A_FUNC_CASE(rgba_fmt##BE, name##be, opt)   \
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt)  
 \
 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
 
 #define INPUT_PLANER_RGBAXX_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt)
   \
@@ -696,7 +696,7 @@ switch(c->dstBpc){ \
 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
 
 #define INPUT_PLANER_RGB_YUVA_ALL_CASES(opt)   
  \
-INPUT_PLANER_RGB_A_FUNC_CASE(  AV_PIX_FMT_GBRAP,   
rgb, opt) \
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(  AV_PIX_FMT_GBRAP,   
rgb, opt) \
 INPUT_PLANER_RGB_YUV_FUNC_CASE(AV_PIX_FMT_GBRP,
rgb, opt) \
 INPUT_PLANER_RGBXX_YUV_FUNC_CASE(  AV_PIX_FMT_GBRP9,   
   rgb9, opt) \
 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP10,  
AV_PIX_FMT_GBRAP10,   rgb10, opt) \
@@ -708,7 +708,7 @@ switch(c->dstBpc){ \
 
 if (EXTERNAL_SSE2(cpu_flags)) {
 switch (c->srcFormat) {
-INPUT_PLANER_RGB_A_FUNC_CASE(  AV_PIX_FMT_GBRAP,   
rgb, sse2);
+INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(  AV_PIX_FMT_GBRAP,   
rgb, sse2);
 INPUT_PLANER_RGB_UV_FUNC_CASE( AV_PIX_FMT_GBRP,
rgb, sse2);
 INPUT_PLANER_RGBXX_UV_FUNC_CASE(   AV_PIX_FMT_GBRP9,   
   rgb9, sse2);
 INPUT_PLANER_RGBAXX_UVA_FUNC_CASE( AV_PIX_FMT_GBRP10,  
AV_PIX_FMT_GBRAP10,   rgb10, sse2);
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 3/7] avutil/tests/opt: Check av_set_options_string() for failure

2024-05-20 Thread Michael Niedermayer
This is test code after all so it should test things

Fixes: CID1518990 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavutil/tests/opt.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index d189938d9ba..02b3ed6e90e 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -304,6 +304,7 @@ int main(void)
 {
 TestContext test_ctx = { 0 };
 char *buf;
+int ret;
 test_ctx.class = _class;
 
 av_log_set_level(AV_LOG_QUIET);
@@ -314,8 +315,10 @@ int main(void)
 av_opt_free(_ctx);
 memset(_ctx, 0, sizeof(test_ctx));
 test_ctx.class = _class;
-av_set_options_string(_ctx, buf, "=", ",");
+ret = av_set_options_string(_ctx, buf, "=", ",");
 av_free(buf);
+if (ret < 0)
+printf("Error ret '%d'\n", ret);
 if (av_opt_serialize(_ctx, 0, 0, , '=', ',') >= 0) {
 ChildContext child_ctx = { 0 };
 printf("%s\n", buf);
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 2/7] avutil/tests/dict: Check av_dict_set() before get for failure

2024-05-20 Thread Michael Niedermayer
Failure is possible due to strdup()

Fixes: CID1516764 Dereference null return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavutil/tests/dict.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
index e45bc220cb3..21368203ce2 100644
--- a/libavutil/tests/dict.c
+++ b/libavutil/tests/dict.c
@@ -150,12 +150,15 @@ int main(void)
 
 //valgrind sensible test
 printf("\nTesting av_dict_set() with existing AVDictionaryEntry.key as 
key\n");
-av_dict_set(, "key", "old", 0);
+if (av_dict_set(, "key", "old", 0) < 0)
+return 1;
 e = av_dict_get(dict, "key", NULL, 0);
-av_dict_set(, e->key, "new val OK", 0);
+if (av_dict_set(, e->key, "new val OK", 0) < 0)
+return 1;
 e = av_dict_get(dict, "key", NULL, 0);
 printf("%s\n", e->value);
-av_dict_set(, e->key, e->value, 0);
+if (av_dict_set(, e->key, e->value, 0) < 0)
+return 1;
 e = av_dict_get(dict, "key", NULL, 0);
 printf("%s\n", e->value);
 av_dict_free();
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 1/7] avutil/random_seed: Avoid dead returns

2024-05-20 Thread Michael Niedermayer
Fixes: CID1538296 Structurally dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavutil/random_seed.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 6d399cee49c..8a4e4f1fc0b 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -158,10 +158,10 @@ int av_random_bytes(uint8_t* buf, size_t len)
 #elif CONFIG_OPENSSL
 if (RAND_bytes(buf, len) == 1)
 return 0;
-err = AVERROR_EXTERNAL;
-#endif
-
+return AVERROR_EXTERNAL;
+#else
 return err;
+#endif
 }
 
 uint32_t av_get_random_seed(void)
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_drm: Check ioctl in drm_map_frame() for failure

2024-05-20 Thread Michael Niedermayer
On Mon, May 20, 2024 at 11:33:41AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1583742 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavutil/hwcontext_drm.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
> > index 0847db09a08..e080c0597b8 100644
> > --- a/libavutil/hwcontext_drm.c
> > +++ b/libavutil/hwcontext_drm.c
> > @@ -166,7 +166,10 @@ static int drm_map_frame(AVHWFramesContext *hwfc,
> >  #if HAVE_LINUX_DMA_BUF_H
> >  /* We're not checking for errors here because the kernel may not
> >   * support the ioctl, in which case its okay to carry on */
> > -ioctl(desc->objects[i].fd, DMA_BUF_IOCTL_SYNC, _start);
> > +if (ioctl(desc->objects[i].fd, DMA_BUF_IOCTL_SYNC, _start) == 
> > -1) {
> > +err = AVERROR(errno);
> > +goto fail;
> > +}
> >  #endif
> >  }
> >  map->nb_regions = i;
> 
> Did you read the comment above the code?

Apparently not

patch droped, will mark this as intentional

thx

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avutil/hwcontext_drm: Check ioctl in drm_map_frame() for failure

2024-05-19 Thread Michael Niedermayer
Fixes: CID1583742 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavutil/hwcontext_drm.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_drm.c b/libavutil/hwcontext_drm.c
index 0847db09a08..e080c0597b8 100644
--- a/libavutil/hwcontext_drm.c
+++ b/libavutil/hwcontext_drm.c
@@ -166,7 +166,10 @@ static int drm_map_frame(AVHWFramesContext *hwfc,
 #if HAVE_LINUX_DMA_BUF_H
 /* We're not checking for errors here because the kernel may not
  * support the ioctl, in which case its okay to carry on */
-ioctl(desc->objects[i].fd, DMA_BUF_IOCTL_SYNC, _start);
+if (ioctl(desc->objects[i].fd, DMA_BUF_IOCTL_SYNC, _start) == -1) 
{
+err = AVERROR(errno);
+goto fail;
+}
 #endif
 }
 map->nb_regions = i;
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH v2 8/8] aacdec: add a decoder for AAC USAC (xHE-AAC)

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 06:54:44PM +0200, Lynne via ffmpeg-devel wrote:
> This commit adds a decoder for the frequency-domain part of USAC.
> 
> What works:
>  - Mono
>  - Stereo (no prediction)
>  - Stereo (mid/side coding)
>  - Stereo (complex prediction)
> 
> What's left:
>  - Speech coding
> 
> Known issues:
>  - Desync with certain sequences
>  - Preroll crossover missing (shouldn't matter, bitrate adaptation only)
> ---
>  libavcodec/aac/Makefile  |3 +-
>  libavcodec/aac/aacdec.c  |  188 +--
>  libavcodec/aac/aacdec.h  |  187 +++
>  libavcodec/aac/aacdec_ac.c   |  208 
>  libavcodec/aac/aacdec_ac.h   |   54 +
>  libavcodec/aac/aacdec_dsp_template.c |4 +-
>  libavcodec/aac/aacdec_latm.h |   14 +-
>  libavcodec/aac/aacdec_lpd.c  |  198 
>  libavcodec/aac/aacdec_lpd.h  |   33 +
>  libavcodec/aac/aacdec_usac.c | 1587 ++
>  libavcodec/aac/aacdec_usac.h |   39 +
>  libavcodec/aactab.c  |   42 +
>  libavcodec/aactab.h  |   10 +
>  13 files changed, 2491 insertions(+), 76 deletions(-)
>  create mode 100644 libavcodec/aac/aacdec_ac.c
>  create mode 100644 libavcodec/aac/aacdec_ac.h
>  create mode 100644 libavcodec/aac/aacdec_lpd.c
>  create mode 100644 libavcodec/aac/aacdec_lpd.h
>  create mode 100644 libavcodec/aac/aacdec_usac.c
>  create mode 100644 libavcodec/aac/aacdec_usac.h

seems to break fate

make  -j32 fate-source
TESTsource
--- ./tests/ref/fate/source 2024-05-20 01:14:59.40702 +0200
+++ tests/data/fate/source  2024-05-20 01:17:32.661142354 +0200
@@ -23,6 +25,7 @@
 compat/djgpp/math.h
 compat/float/float.h
 compat/float/limits.h
+libavcodec/aac/aacdec_ac.h
 libavcodec/bitstream_template.h
 tools/decode_simple.h
 Use of av_clip() where av_clip_uintp2() could be used:
Test source failed. Look at tests/data/fate/source.err for details.
make: *** [tests/Makefile:311: fate-source] Error 1

thx

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] tests/ref/fate/source: Add exceptions for riscv startcode files

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 10:49:52AM +0200, Andreas Rheinhardt wrote:
> Fixes fate-source.

LGTM

it can be debated after test targets are fixed what is the best solution

thx

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Use 64bit in bit computation

2024-05-19 Thread Michael Niedermayer
On Sun, May 12, 2024 at 02:03:46AM +0200, Michael Niedermayer wrote:
> I dont think this can actually overflow but 64bit seems reasonable to use
> 
> Fixes: CID1521983 Unintentional integer overflow
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/mpeg12dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patch 2 - 5


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

You can kill me, but you cannot change the truth.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] Added alpha layer support v2

2024-05-19 Thread Michael Niedermayer
On Fri, May 17, 2024 at 12:42:28AM +0200, Andrea Mastroberti via ffmpeg-devel 
wrote:
>  doc/filters.texi   |   20 +++-
>  libavfilter/version.h  |3 ++-
>  libavfilter/vf_smartblur.c |   43 +++
>  3 files changed, 56 insertions(+), 10 deletions(-)
> f825c722096295535c4f43e604454c3396519e85  
> 0001-avfilter-smartblur-Added-alpha-layer-support.patch
> From 8b62312d794ecb66cc1a8dbe4933fca0d725057b Mon Sep 17 00:00:00 2001
> From: Andrea Mastroberti <10736...@polimi.it>
> Date: Fri, 17 May 2024 00:29:01 +0200
> Subject: [PATCH] avfilter/smartblur: Added alpha layer support
> 
> ---
>  doc/filters.texi   | 20 +-
>  libavfilter/version.h  |  3 ++-
>  libavfilter/vf_smartblur.c | 43 +++---
>  3 files changed, 56 insertions(+), 10 deletions(-)

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Homeopathy is like voting while filling the ballot out with transparent ink.
Sometimes the outcome one wanted occurs. Rarely its worse than filling out
a ballot properly.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 2/2] avcodec/tests/jpeg2000dwt: Use 64bit in comparission

2024-05-19 Thread Michael Niedermayer
Found while reviewing: CID1500309 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tests/jpeg2000dwt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tests/jpeg2000dwt.c b/libavcodec/tests/jpeg2000dwt.c
index 6148f0dacfe..520ecc05a3a 100644
--- a/libavcodec/tests/jpeg2000dwt.c
+++ b/libavcodec/tests/jpeg2000dwt.c
@@ -52,7 +52,7 @@ static int test_dwt(int *array, int *ref, int border[2][2], 
int decomp_levels, i
 return 1;
 }
 for (j = 0; j max_diff) {
+if (FFABS(array[j] - (int64_t)ref[j]) > max_diff) {
 fprintf(stderr, "missmatch at %d (%d != %d) decomp:%d border %d %d 
%d %d\n",
 j, array[j], ref[j],decomp_levels, border[0][0], 
border[0][1], border[1][0], border[1][1]);
 return 2;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 1/2] avcodec/tests/jpeg2000dwt: Use 64bit in err2 computation

2024-05-19 Thread Michael Niedermayer
This issue cannot happen with the current function parameters

Fixes: CID1500309 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tests/jpeg2000dwt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tests/jpeg2000dwt.c b/libavcodec/tests/jpeg2000dwt.c
index 0e5a6ed9471..6148f0dacfe 100644
--- a/libavcodec/tests/jpeg2000dwt.c
+++ b/libavcodec/tests/jpeg2000dwt.c
@@ -57,7 +57,7 @@ static int test_dwt(int *array, int *ref, int border[2][2], 
int decomp_levels, i
 j, array[j], ref[j],decomp_levels, border[0][0], 
border[0][1], border[1][0], border[1][1]);
 return 2;
 }
-err2 += (array[j] - ref[j]) * (array[j] - ref[j]);
+err2 += (array[j] - ref[j]) * (int64_t)(array[j] - ref[j]);
 array[j] = ref[j];
 }
 ff_dwt_destroy(s);
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/qsvdec: Check av_image_get_buffer_size() for failure

2024-05-19 Thread Michael Niedermayer
On Mon, May 13, 2024 at 01:47:36AM +, Xiang, Haihao wrote:
> On Ma, 2024-05-13 at 03:20 +0200, Michael Niedermayer wrote:
> > Fixes: CID1477406 Improper use of negative value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/qsvdec.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> > index ed0bfe4c8b8..a51ddace622 100644
> > --- a/libavcodec/qsvdec.c
> > +++ b/libavcodec/qsvdec.c
> > @@ -379,9 +379,12 @@ static int qsv_decode_init_context(AVCodecContext 
> > *avctx,
> > QSVContext *q, mfxVide
> >  
> >  q->frame_info = param->mfx.FrameInfo;
> >  
> > -    if (!avctx->hw_frames_ctx)
> > -    q->pool = av_buffer_pool_init(av_image_get_buffer_size(avctx-
> > >pix_fmt,
> > -    FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64),
> > 1), av_buffer_allocz);
> > +    if (!avctx->hw_frames_ctx) {
> > +    ret = av_image_get_buffer_size(avctx->pix_fmt, 
> > FFALIGN(avctx->width,
> > 128), FFALIGN(avctx->height, 64), 1);
> > +    if (ret < 0)
> > +    return ret;
> > +    q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
> > +    }
> >  return 0;
> >  }
> >  
> 
> LGTM, thx

will apply

thx

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 06:05:20PM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Helps: CID1548380 Uninitialized scalar variable
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/rv34.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
> > index 23a570bb807..4ce0cc58d05 100644
> > --- a/libavcodec/rv34.c
> > +++ b/libavcodec/rv34.c
> > @@ -98,6 +98,8 @@ static av_cold void rv34_gen_vlc_ext(const uint8_t *bits, 
> > int size, VLC *vlc,
> >  uint16_t cw[MAX_VLC_SIZE];
> >  int maxbits;
> >  
> > +av_assert0(size > 0);
> > +
> >  for (int i = 0; i < size; i++)
> >  counts[bits[i]]++;
> >  
> 
> An av_assert0 just because of Coverity? Why not av_assert1?

the function is av_cold, so it doesnt really matter i think
but changed to av_assert1 locally

thx

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

Nations do behave wisely once they have exhausted all other alternatives. 
-- Abba Eban


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert

2024-05-19 Thread Michael Niedermayer
On Sat, May 18, 2024 at 06:33:12PM +1000, Peter Ross wrote:
> On Sat, May 18, 2024 at 05:57:43AM +0200, Michael Niedermayer wrote:
> > Fixes: CID1452425 Logically dead code
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vp3.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
> > index 09527607767..d03a1c9dbc1 100644
> > --- a/libavcodec/vp3.c
> > +++ b/libavcodec/vp3.c
> > @@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, 
> > int plane, int motion_x, int
> >  x_offset = (-(x + 2) & 7) + 2;
> >  y_offset = (-(y + 2) & 7) + 2;
> >  
> > -if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
> > -return 0;
> > +av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
> >  
> 
> ok

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder()

2024-05-19 Thread Michael Niedermayer
On Sat, May 18, 2024 at 11:07:15AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Fri, May 17, 2024 at 11:59 PM Michael Niedermayer 
> wrote:
> 
> > Fixes: CID1507483 Unchecked return value
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vp8.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
> > index 19f32b34006..8e91613068a 100644
> > --- a/libavcodec/vp8.c
> > +++ b/libavcodec/vp8.c
> > @@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const
> > uint8_t *buf, int buf_size)
> >  }
> >
> >  s->coeff_partition_size[i] = buf_size;
> > -ff_vpx_init_range_decoder(>coeff_partition[i], buf, buf_size);
> >
> > -return 0;
> > +return ff_vpx_init_range_decoder(>coeff_partition[i], buf,
> > buf_size);
> >  }
> >
> >  static void vp7_get_quants(VP8Context *s)
> > --
> > 2.45.1
> >
> 
> OK.

will apply

thx

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

It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 7/9] avcodec/vvc/mvs: Initialize mvf

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 10:28:49PM +0800, Nuo Mi wrote:
> On Sun, May 19, 2024 at 10:50 AM Michael Niedermayer 
> wrote:
> 
> > This might not be needed for correctness but it could
> > help general reproducability of issues
> >
> > Related to: CID1560037 Uninitialized scalar variable
> > Related to: CID1560044 Uninitialized scalar variable
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vvc/mvs.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/vvc/mvs.c b/libavcodec/vvc/mvs.c
> > index fe7d9234603..521cf96a896 100644
> > --- a/libavcodec/vvc/mvs.c
> > +++ b/libavcodec/vvc/mvs.c
> > @@ -411,7 +411,7 @@ void ff_vvc_store_sb_mvs(const VVCLocalContext *lc,
> > PredictionUnit *pu)
> >  const int sbw = cu->cb_width / mi->num_sb_x;
> >  const int sbh = cu->cb_height / mi->num_sb_y;
> >  SubblockParams params[2];
> > -MvField mvf;
> > +MvField mvf = {0};
> >
> >  mvf.pred_flag = mi->pred_flag;
> >  mvf.bcw_idx = mi->bcw_idx;
> > @@ -504,7 +504,7 @@ void ff_vvc_store_mvf(const VVCLocalContext *lc, const
> > MvField *mvf)
> >  void ff_vvc_store_mv(const VVCLocalContext *lc, const MotionInfo *mi)
> >  {
> >  const CodingUnit *cu = lc->cu;
> > -MvField mvf;
> > +MvField mvf = {0};
> >
> >  mvf.hpel_if_idx = mi->hpel_if_idx;
> >  mvf.bcw_idx = mi->bcw_idx;
> > --
> > 2.45.1
> >
> both  "mvf.ciip_flag = 0" are not needed if we set mvf to 0

locally changed

thx

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 6/9] avcodec/vvc/dec: Check init_get_bits8() for failure

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 10:31:50PM +0800, Nuo Mi wrote:
> On Sun, May 19, 2024 at 10:50 AM Michael Niedermayer 
> wrote:
> 
> > Fixes: CID1560042 Unchecked return value
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vvc/dec.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> > index d262d310125..f2ede490c8b 100644
> > --- a/libavcodec/vvc/dec.c
> > +++ b/libavcodec/vvc/dec.c
> > @@ -514,6 +514,7 @@ static int slice_init_entry_points(SliceContext *sc,
> >  int nb_eps= sh->r->num_entry_points + 1;
> >  int ctu_addr  = 0;
> >  GetBitContext gb;
> > +int ret;
> >
> >  if (sc->nb_eps != nb_eps) {
> >  eps_free(sc);
> > @@ -523,7 +524,9 @@ static int slice_init_entry_points(SliceContext *sc,
> >  sc->nb_eps = nb_eps;
> >  }
> >
> > -init_get_bits8(, slice->data, slice->data_size);
> > +ret = init_get_bits8(, slice->data, slice->data_size);
> > +if (ret < 0)
> > +return ret;
> >  for (int i = 0; i < sc->nb_eps; i++)
> >  {
> >  EntryPoint *ep = sc->eps + i;
> >
> LGTM.
> Thank you, Michael.

will apply

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/9] avcodec/vqcdec: Check init_get_bits8() for failure

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 01:18:09PM +1000, Peter Ross wrote:
> On Sun, May 19, 2024 at 04:49:07AM +0200, Michael Niedermayer wrote:
> > Fixes: CID1516090 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vqcdec.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
> > index 5c6cab3c1ab..bb69844327d 100644
> > --- a/libavcodec/vqcdec.c
> > +++ b/libavcodec/vqcdec.c
> > @@ -147,10 +147,13 @@ static int decode_vectors(VqcContext * s, const 
> > uint8_t * buf, int size, int wid
> >  GetBitContext gb;
> >  uint8_t * vectors = s->vectors;
> >  uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
> > +int ret;
> >  
> >  memset(vectors, 0, 3 * width * height / 2);
> >  
> > -init_get_bits8(, buf, size);
> > +ret = init_get_bits8(, buf, size);
> > +if (ret < 0)
> > +return ret;
> >  
> >  for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
> >  uint8_t * dst = vectors;
> 
> ok

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 3/9] avcodec/vvc/ctu: Simplify pred_mode_plt_flag

2024-05-19 Thread Michael Niedermayer
On Sun, May 19, 2024 at 10:40:57PM +0800, Nuo Mi wrote:
> On Sun, May 19, 2024 at 10:49 AM Michael Niedermayer 
> wrote:
> 
> > Fixes: CID1560039 Logically dead code
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/vvc/ctu.c | 23 ++-
> >  1 file changed, 6 insertions(+), 17 deletions(-)
> >
> > diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
> > index 7495ced0d5a..b7089b9a004 100644
> > --- a/libavcodec/vvc/ctu.c
> > +++ b/libavcodec/vvc/ctu.c
> > @@ -1793,7 +1793,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> > x0, int y0, int cb_width, in
> >  const int hs= sps->hshift[CHROMA];
> >  const int vs= sps->vshift[CHROMA];
> >  const int is_128= cb_width > 64 || cb_height > 64;
> > -int pred_mode_plt_flag  = 0;
> >  int ret;
> >
> >  CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth,
> > tree_type);
> > @@ -1811,7 +1810,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int
> > x0, int y0, int cb_width, in
> >  mode_type != MODE_TYPE_INTER && ((cb_width * cb_height) >
> >  (tree_type != DUAL_TREE_CHROMA ? 16 : (16 << hs << vs))) &&
> >  (mode_type != MODE_TYPE_INTRA || tree_type != DUAL_TREE_CHROMA)) {
> > -pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
> > +int pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
> >  if (pred_mode_plt_flag) {
> >  avpriv_report_missing_feature(fc->log_ctx, "Palette");
> >  return AVERROR_PATCHWELCOME;
> > @@ -1823,31 +1822,21 @@ static int hls_coding_unit(VVCLocalContext *lc,
> > int x0, int y0, int cb_width, in
> >  }
> >  if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
> >  if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
> > -if (pred_mode_plt_flag) {
> > -avpriv_report_missing_feature(fc->log_ctx, "Palette");
> > -return AVERROR_PATCHWELCOME;
> > -} else {
> > -intra_luma_pred_modes(lc);
> > -}
> > +intra_luma_pred_modes(lc);
> >  ff_vvc_set_intra_mvf(lc, 0);
> >  }
> >  if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA)
> > && sps->r->sps_chroma_format_idc) {
> > -if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
> > -avpriv_report_missing_feature(fc->log_ctx, "Palette");
> > -return AVERROR_PATCHWELCOME;
> > -} else if (!pred_mode_plt_flag) {
> > -if (!cu->act_enabled_flag)
> > -intra_chroma_pred_modes(lc);
> > -}
> > +if (!cu->act_enabled_flag)
> > +intra_chroma_pred_modes(lc);
> >  }
> >  } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC
> > */
> >  if ((ret = inter_data(lc)) < 0)
> >  return ret;
> >  }
> > -if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag &&
> > !lc->cu->pu.general_merge_flag)
> > +if (cu->pred_mode != MODE_INTRA && !lc->cu->pu.general_merge_flag)
> >  cu->coded_flag = ff_vvc_cu_coded_flag(lc);
> >  else
> > -cu->coded_flag = !(cu->skip_flag || pred_mode_plt_flag);
> > +cu->coded_flag = !(cu->skip_flag);
> >
> >  if (cu->coded_flag) {
> >  sbt_info(lc, sps);
> > --
> > 2.45.1
> >
> Hi  Michael,
> Could we skip this one?
> Thanks to Jianhua's help. We may have Palette support in the next month.

of course, patch droped, issues marked as intentional in coverity

thx

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 9/9] avcodec/wavpackenc: Use unsigned for potential 31bit shift

2024-05-18 Thread Michael Niedermayer
Fixes: CID1465481 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/wavpackenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index ba0371592d9..e99ab951d41 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -1979,7 +1979,7 @@ static void encode_flush(WavPackEncodeContext *s)
 put_bits(pb, 31, 0x7FFF);
 cbits -= 31;
 } else {
-put_bits(pb, cbits, (1 << cbits) - 1);
+put_bits(pb, cbits, (1U << cbits) - 1);
 cbits = 0;
 }
 } while (cbits);
@@ -2008,7 +2008,7 @@ static void encode_flush(WavPackEncodeContext *s)
 put_bits(pb, 31, 0x7FFF);
 cbits -= 31;
 } else {
-put_bits(pb, cbits, (1 << cbits) - 1);
+put_bits(pb, cbits, (1U << cbits) - 1);
 cbits = 0;
 }
 } while (cbits);
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 8/9] avcodec/wavpack: Remove dead assignments

2024-05-18 Thread Michael Niedermayer
Fixes: CID1442018 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/wavpack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index d4cf489c0fa..bf9aa0cdcec 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1418,13 +1418,13 @@ static int wavpack_decode_block(AVCodecContext *avctx, 
AVFrame *frame, int block
 chmask = bytestream2_get_le32();
 break;
 case 4:
-size = bytestream2_get_byte();
+bytestream2_get_byte();
 chan  |= (bytestream2_get_byte() & 0xF) << 8;
 chan  += 1;
 chmask = bytestream2_get_le24();
 break;
 case 5:
-size = bytestream2_get_byte();
+bytestream2_get_byte();
 chan  |= (bytestream2_get_byte() & 0xF) << 8;
 chan  += 1;
 chmask = bytestream2_get_le32();
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 7/9] avcodec/vvc/mvs: Initialize mvf

2024-05-18 Thread Michael Niedermayer
This might not be needed for correctness but it could
help general reproducability of issues

Related to: CID1560037 Uninitialized scalar variable
Related to: CID1560044 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/mvs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vvc/mvs.c b/libavcodec/vvc/mvs.c
index fe7d9234603..521cf96a896 100644
--- a/libavcodec/vvc/mvs.c
+++ b/libavcodec/vvc/mvs.c
@@ -411,7 +411,7 @@ void ff_vvc_store_sb_mvs(const VVCLocalContext *lc, 
PredictionUnit *pu)
 const int sbw = cu->cb_width / mi->num_sb_x;
 const int sbh = cu->cb_height / mi->num_sb_y;
 SubblockParams params[2];
-MvField mvf;
+MvField mvf = {0};
 
 mvf.pred_flag = mi->pred_flag;
 mvf.bcw_idx = mi->bcw_idx;
@@ -504,7 +504,7 @@ void ff_vvc_store_mvf(const VVCLocalContext *lc, const 
MvField *mvf)
 void ff_vvc_store_mv(const VVCLocalContext *lc, const MotionInfo *mi)
 {
 const CodingUnit *cu = lc->cu;
-MvField mvf;
+MvField mvf = {0};
 
 mvf.hpel_if_idx = mi->hpel_if_idx;
 mvf.bcw_idx = mi->bcw_idx;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 6/9] avcodec/vvc/dec: Check init_get_bits8() for failure

2024-05-18 Thread Michael Niedermayer
Fixes: CID1560042 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/dec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index d262d310125..f2ede490c8b 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -514,6 +514,7 @@ static int slice_init_entry_points(SliceContext *sc,
 int nb_eps= sh->r->num_entry_points + 1;
 int ctu_addr  = 0;
 GetBitContext gb;
+int ret;
 
 if (sc->nb_eps != nb_eps) {
 eps_free(sc);
@@ -523,7 +524,9 @@ static int slice_init_entry_points(SliceContext *sc,
 sc->nb_eps = nb_eps;
 }
 
-init_get_bits8(, slice->data, slice->data_size);
+ret = init_get_bits8(, slice->data, slice->data_size);
+if (ret < 0)
+return ret;
 for (int i = 0; i < sc->nb_eps; i++)
 {
 EntryPoint *ep = sc->eps + i;
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 5/9] avcodec/vvc/dec: Remove constant eos_at_start

2024-05-18 Thread Michael Niedermayer
Fixes: CID1560041 'Constant' variable guards dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/dec.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 25cdb39cabb..d262d310125 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -825,7 +825,6 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext 
*fc, AVPacket *avpkt)
 const CodedBitstreamH266Context *h266 = s->cbc->priv_data;
 CodedBitstreamFragment *frame = >current_frame;
 int ret = 0;
-int eos_at_start = 1;
 s->last_eos = s->eos;
 s->eos = 0;
 
@@ -841,10 +840,7 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext 
*fc, AVPacket *avpkt)
 const CodedBitstreamUnit *unit = frame->units + i;
 
 if (unit->type == VVC_EOB_NUT || unit->type == VVC_EOS_NUT) {
-if (eos_at_start)
-s->last_eos = 1;
-else
-s->eos = 1;
+s->last_eos = 1;
 } else {
 ret = decode_nal_unit(s, fc, nal, unit);
 if (ret < 0) {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 4/9] avcodec/vvc/ctu: Remove dead ret check

2024-05-18 Thread Michael Niedermayer
Fixes: CID1560040 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/ctu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index b7089b9a004..89eb9d338c7 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1854,8 +1854,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, 
int y0, int cb_width, in
 cu->lfnst_idx = lfnst_idx_decode(lc);
 cu->mts_idx = mts_idx_decode(lc);
 set_qp_c(lc);
-if (ret < 0)
-return ret;
 } else {
 ret = skipped_transform_tree_unit(lc);
 if (ret < 0)
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 3/9] avcodec/vvc/ctu: Simplify pred_mode_plt_flag

2024-05-18 Thread Michael Niedermayer
Fixes: CID1560039 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/ctu.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index 7495ced0d5a..b7089b9a004 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1793,7 +1793,6 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, 
int y0, int cb_width, in
 const int hs= sps->hshift[CHROMA];
 const int vs= sps->vshift[CHROMA];
 const int is_128= cb_width > 64 || cb_height > 64;
-int pred_mode_plt_flag  = 0;
 int ret;
 
 CodingUnit *cu = add_cu(lc, x0, y0, cb_width, cb_height, cqt_depth, 
tree_type);
@@ -1811,7 +1810,7 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, 
int y0, int cb_width, in
 mode_type != MODE_TYPE_INTER && ((cb_width * cb_height) >
 (tree_type != DUAL_TREE_CHROMA ? 16 : (16 << hs << vs))) &&
 (mode_type != MODE_TYPE_INTRA || tree_type != DUAL_TREE_CHROMA)) {
-pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
+int pred_mode_plt_flag = ff_vvc_pred_mode_plt_flag(lc);
 if (pred_mode_plt_flag) {
 avpriv_report_missing_feature(fc->log_ctx, "Palette");
 return AVERROR_PATCHWELCOME;
@@ -1823,31 +1822,21 @@ static int hls_coding_unit(VVCLocalContext *lc, int x0, 
int y0, int cb_width, in
 }
 if (cu->pred_mode == MODE_INTRA || cu->pred_mode == MODE_PLT) {
 if (tree_type == SINGLE_TREE || tree_type == DUAL_TREE_LUMA) {
-if (pred_mode_plt_flag) {
-avpriv_report_missing_feature(fc->log_ctx, "Palette");
-return AVERROR_PATCHWELCOME;
-} else {
-intra_luma_pred_modes(lc);
-}
+intra_luma_pred_modes(lc);
 ff_vvc_set_intra_mvf(lc, 0);
 }
 if ((tree_type == SINGLE_TREE || tree_type == DUAL_TREE_CHROMA) && 
sps->r->sps_chroma_format_idc) {
-if (pred_mode_plt_flag && tree_type == DUAL_TREE_CHROMA) {
-avpriv_report_missing_feature(fc->log_ctx, "Palette");
-return AVERROR_PATCHWELCOME;
-} else if (!pred_mode_plt_flag) {
-if (!cu->act_enabled_flag)
-intra_chroma_pred_modes(lc);
-}
+if (!cu->act_enabled_flag)
+intra_chroma_pred_modes(lc);
 }
 } else if (tree_type != DUAL_TREE_CHROMA) { /* MODE_INTER or MODE_IBC */
 if ((ret = inter_data(lc)) < 0)
 return ret;
 }
-if (cu->pred_mode != MODE_INTRA && !pred_mode_plt_flag && 
!lc->cu->pu.general_merge_flag)
+if (cu->pred_mode != MODE_INTRA && !lc->cu->pu.general_merge_flag)
 cu->coded_flag = ff_vvc_cu_coded_flag(lc);
 else
-cu->coded_flag = !(cu->skip_flag || pred_mode_plt_flag);
+cu->coded_flag = !(cu->skip_flag);
 
 if (cu->coded_flag) {
 sbt_info(lc, sps);
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 2/9] avcodec/vvc/ctu: Simplify code at the end of pred_mode_decode()

2024-05-18 Thread Michael Niedermayer
This simplification assumes that the code is correct

Fixes: CID1560036 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/ctu.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c
index 53f92ca10f7..7495ced0d5a 100644
--- a/libavcodec/vvc/ctu.c
+++ b/libavcodec/vvc/ctu.c
@@ -1080,12 +1080,10 @@ static PredMode pred_mode_decode(VVCLocalContext *lc,
 }
 if (pred_mode_ibc_flag)
 pred_mode = MODE_IBC;
+return pred_mode;
 } else {
-pred_mode_flag = is_4x4 || mode_type == MODE_TYPE_INTRA ||
-mode_type != MODE_TYPE_INTER || IS_I(rsh);
-pred_mode = pred_mode_flag ? MODE_INTRA : MODE_INTER;
+return MODE_INTRA;
 }
-return pred_mode;
 }
 
 static void sbt_info(VVCLocalContext *lc, const VVCSPS *sps)
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 1/9] avcodec/vqcdec: Check init_get_bits8() for failure

2024-05-18 Thread Michael Niedermayer
Fixes: CID1516090 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vqcdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 5c6cab3c1ab..bb69844327d 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -147,10 +147,13 @@ static int decode_vectors(VqcContext * s, const uint8_t * 
buf, int size, int wid
 GetBitContext gb;
 uint8_t * vectors = s->vectors;
 uint8_t * vectors_end = s->vectors + (width * height * 3) / 2;
+int ret;
 
 memset(vectors, 0, 3 * width * height / 2);
 
-init_get_bits8(, buf, size);
+ret = init_get_bits8(, buf, size);
+if (ret < 0)
+return ret;
 
 for (int i = 0; i < 3 * width * height / 2 / 32; i++) {
 uint8_t * dst = vectors;
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_demux: also set -ch_layout avcodec option for -ch_layout CLI param

2024-05-18 Thread Michael Niedermayer
On Sat, May 18, 2024 at 06:11:12PM +0200, Marton Balint wrote:
> The code only set the channel layout of the AVFormatContext, so the user could
> not override the channel layout if the demuxer did not have such parameter.
> Let's set the specified channel layouts as codec options as well.
> 
> Fixes ticket #11016.
> 
> A regression since 639c2f00497257cb60ecaeeac1aacfa80df3be06.
> 
> Signed-off-by: Marton Balint 

breaks:
./ffmpeg  -f u8 -ar 8000 -ac 1 -i /dev/zero  -acodec aac -y  -t 1   -b:a 48k 
/tmp/aac.nut

[aac @ 0x55d4ed264800] Unsupported channel layout "1 channels"
[aac @ 0x55d4ed264800] Qavg: nan
[aost#0:0/aac @ 0x55d4ed24d800] Error while opening encoder - maybe incorrect 
parameters such as bit_rate, rate, width or height.
[af#0:0 @ 0x55d4ed264cc0] Error sending frames to consumers: Invalid argument
[af#0:0 @ 0x55d4ed264cc0] Task finished with error code: -22 (Invalid argument)
[af#0:0 @ 0x55d4ed264cc0] Terminating thread with return code -22 (Invalid 
argument)
[aost#0:0/aac @ 0x55d4ed24d800] Could not open encoder before EOF
[aost#0:0/aac @ 0x55d4ed24d800] Task finished with error code: -22 (Invalid 
argument)
[aost#0:0/aac @ 0x55d4ed24d800] Terminating thread with return code -22 
(Invalid argument)
[out#0/nut @ 0x55d4ed254040] Nothing was written into output file, because at 
least one of its streams received no packets.
size=   0KiB time=N/A bitrate=N/A speed=N/A

thx

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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] lavd/v4l2: Use proper field type for second parameter of ioctl() with BSD's

2024-05-18 Thread Michael Niedermayer
On Sat, May 18, 2024 at 07:27:35AM -0400, Brad Smith wrote:
> Can this be backported to 7, 6, 5 and 4.4 releases?

yes and everyone who has write access to master also has write access to
the releases branches!

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 4/6] lavf/tls_mbedtls: fix handling of certification validation failures

2024-05-18 Thread Michael Niedermayer
On Fri, May 17, 2024 at 10:34:41AM +0200, Sfan5 wrote:
> We manually check the verification status after the handshake has completed
> using mbedtls_ssl_get_verify_result(). However with VERIFY_REQUIRED
> mbedtls_ssl_handshake() already returns an error, so this code is never
> reached.
> Fix that by using VERIFY_OPTIONAL, which performs the verification but
> does not abort the handshake.
> 
> Signed-off-by: sfan5 
> ---
>  libavformat/tls_mbedtls.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
> index 9508fe3436..67d5c568b9 100644
> --- a/libavformat/tls_mbedtls.c
> +++ b/libavformat/tls_mbedtls.c
> @@ -263,8 +263,9 @@ static int tls_open(URLContext *h, const char *uri, int
> flags, AVDictionary **op
>  goto fail;
>  }
>  +// not VERIFY_REQUIRED because we manually check after handshake
>  mbedtls_ssl_conf_authmode(_ctx->ssl_config,
> -  shr->verify ? MBEDTLS_SSL_VERIFY_REQUIRED :
> MBEDTLS_SSL_VERIFY_NONE);
> +  shr->verify ? MBEDTLS_SSL_VERIFY_OPTIONAL :
> MBEDTLS_SSL_VERIFY_NONE);
>  mbedtls_ssl_conf_rng(_ctx->ssl_config, mbedtls_ctr_drbg_random,
> _ctx->ctr_drbg_context);
>  mbedtls_ssl_conf_ca_chain(_ctx->ssl_config, _ctx->ca_cert,
> NULL);

This patch looks corrupted by extra line breaks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()

2024-05-18 Thread Michael Niedermayer
On Sat, May 18, 2024 at 08:02:28AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Helps: CID1441939 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/tiff.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index ca7e9f6aba9..31de6ad7308 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
> >  GetBitContext gb;
> >  uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
> >  
> > -init_get_bits8(, src, width);
> > +int ret = init_get_bits8(, src, width);
> > +av_assert1(ret >= 0);
> >  
> >  for (int i = 0; i < s->width; i++) {
> >  dst[i] = get_bits(, bpp);
> 
> What guarantees that this is not triggered?

Several arguments, first one is simply that linesize*allocated_height must be 
addressable with an int index
which in practice ends on the check "stride*(uint64_t)(h+128) >= INT_MAX" in 
av_image_check_size2

so I would expect a width * 8 not to overflow if a stride * (h+128) cannot
(this is a bit fuzzy as our width can contain some subsampling factors though i
doubt they can be that large)

the 2nd is that
int width = ((s->width * s->bpp) + 7) >> 3;
or teh alethernative path contains a av_assert0(width <= bytes_per_row);
where int bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
both are integers divided by 8 so i would expect no overflow on a multiply by 8

thx

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/vc1_parser: Check init_get_bits8()

2024-05-18 Thread Michael Niedermayer
On Fri, May 17, 2024 at 10:16:27PM +0200, Andreas Rheinhardt wrote:
> Addresses Coverity issue #1441935.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/vc1_parser.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

seems i didnt see this one, as i send a patch for this too
anyway your LGTM

thx

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/jpeg2000dec: fix HT block decoder issue #10905

2024-05-18 Thread Michael Niedermayer
On Fri, May 17, 2024 at 08:00:16PM +, WATANABE Osamu wrote:
> Signed-off-by: Pierre-Anthony Lemieux 
> ---
> libavcodec/jpeg2000htdec.c   | 122 ---
> tests/ref/fate/jpeg2000dec-ds0_ht_01_b11 |   2 +-
> 2 files changed, 63 insertions(+), 61 deletions(-)
> 
> diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> index fa704b665e..62f70c32a8 100644
> --- a/libavcodec/jpeg2000htdec.c
> +++ b/libavcodec/jpeg2000htdec.c
> @@ -196,7 +196,7 @@ static void jpeg2000_bitbuf_refill_forward(StateVars 
> *buffer, const uint8_t *arr
> while (buffer->bits_left < 32) {
> buffer->tmp = 0xFF;
> buffer->bits = (buffer->last == 0xFF) ? 7 : 8;
> -if (buffer->pos <= length) {
> +if (buffer->pos < length) {
> buffer->tmp = array[buffer->pos];
> buffer->pos += 1;
> buffer->last = buffer->tmp;
> @@ -508,17 +508,17 @@ static int jpeg2000_decode_sig_emb(const 
> Jpeg2000DecoderContext *s, MelDecoderSt
> }
> 
> av_always_inline
> -static int jpeg2000_get_state(int x1, int x2, int width, int shift_by,
> +static int jpeg2000_get_state(int x1, int x2, int stride, int shift_by,

the first whitespace seems to have been lost this makes git reject the patch

Applying: avcodec/jpeg2000dec: fix HT block decoder issue #10905
error: corrupt patch at line 20
error: could not build fake ancestor

thx

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

What does censorship reveal? It reveals fear. -- Julian Assange


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 9/9] avcodec/vp3: Replace check by assert

2024-05-17 Thread Michael Niedermayer
Fixes: CID1452425 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vp3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 09527607767..d03a1c9dbc1 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2001,8 +2001,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int 
plane, int motion_x, int
 x_offset = (-(x + 2) & 7) + 2;
 y_offset = (-(y + 2) & 7) + 2;
 
-if (x_offset > 8 + x_subpel && y_offset > 8 + y_subpel)
-return 0;
+av_assert1(!(x_offset > 8 + x_subpel && y_offset > 8 + y_subpel));
 
 s->vdsp.emulated_edge_mc(loop, motion_source - stride - 1,
  loop_stride, stride,
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 8/9] avcodec/vp8: Forward return of ff_vpx_init_range_decoder()

2024-05-17 Thread Michael Niedermayer
Fixes: CID1507483 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vp8.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 19f32b34006..8e91613068a 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -341,9 +341,8 @@ static int setup_partitions(VP8Context *s, const uint8_t 
*buf, int buf_size)
 }
 
 s->coeff_partition_size[i] = buf_size;
-ff_vpx_init_range_decoder(>coeff_partition[i], buf, buf_size);
 
-return 0;
+return ff_vpx_init_range_decoder(>coeff_partition[i], buf, buf_size);
 }
 
 static void vp7_get_quants(VP8Context *s)
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 7/9] avcodec/vlc: Cleanup on multi table alloc failure in ff_vlc_init_multi_from_lengths()

2024-05-17 Thread Michael Niedermayer
Fixes: CID1544630 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
index ee09d96fd61..f46ecbb55e9 100644
--- a/libavcodec/vlc.c
+++ b/libavcodec/vlc.c
@@ -529,7 +529,7 @@ int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI 
*multi, int nb_bits, int
 
 multi->table = av_malloc(sizeof(*multi->table) << nb_bits);
 if (!multi->table)
-return AVERROR(ENOMEM);
+goto fail;
 
 j = code = 0;
 for (int i = 0; i < nb_codes; i++, lens += lens_wrap) {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 6/9] avcodec/vc1_parser: Assert init_get_bits success

2024-05-17 Thread Michael Niedermayer
The buffer used is a fixed size buffer from the context, it cannot be too large 
nor
can it be NULL

Helps: CID1441935 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1_parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index ec284dca009..a1557b1ec7e 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -66,7 +66,9 @@ static void vc1_extract_header(AVCodecParserContext *s, 
AVCodecContext *avctx,
 GetBitContext gb;
 int ret;
 vpc->v.s.avctx = avctx;
-init_get_bits8(, buf, buf_size);
+ret = init_get_bits8(, buf, buf_size);
+av_assert1(ret >= 0);
+
 switch (vpc->prev_start_code) {
 case VC1_CODE_SEQHDR & 0xFF:
 ff_vc1_decode_sequence_header(avctx, >v, );
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 5/9] avcodec/vc1_block: remove unneeded store to off in vc1_decode_p_mb_intfi()

2024-05-17 Thread Michael Niedermayer
Found while reviewing code related to coverity

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1_block.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index 1e8e294ad89..322acebfe50 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1771,7 +1771,6 @@ static int vc1_decode_p_mb_intfi(VC1Context *v)
 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & 
AV_CODEC_FLAG_GRAY))
 continue;
 
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
-off  = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
 block_cbp |= 0xf << (i << 2);
 }
 } else {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 4/9] avcodec/vc1_block: remove unused off from vc1_decode_p_mb_intfr()

2024-05-17 Thread Michael Niedermayer
Fixes: CID1435166 Unused value
Fixes: CID1529221 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vc1_block.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index a6ee4922f95..1e8e294ad89 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -1607,10 +1607,6 @@ static int vc1_decode_p_mb_intfr(VC1Context *v)
 if (CONFIG_GRAY && (i > 3) && (s->avctx->flags & 
AV_CODEC_FLAG_GRAY))
 continue;
 
v->vc1dsp.vc1_inv_trans_8x8(v->block[v->cur_blk_idx][block_map[i]]);
-if (i < 4)
-off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * 
s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize;
-else
-off = 0;
 block_cbp |= 0xf << (i << 2);
 }
 
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 3/9] avcodec/vble: Check av_image_get_buffer_size() for failure

2024-05-17 Thread Michael Niedermayer
Fixes: CID1461482 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vble.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index 32157913c77..c585b1ed9fc 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -191,6 +191,9 @@ static av_cold int vble_decode_init(AVCodecContext *avctx)
 ctx->size = av_image_get_buffer_size(avctx->pix_fmt,
  avctx->width, avctx->height, 1);
 
+if (ctx->size < 0)
+return ctx->size;
+
 ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val));
 
 if (!ctx->val) {
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 2/9] avcodec/tiff: Assert init_get_bits8() success in unpack_gray()

2024-05-17 Thread Michael Niedermayer
Helps: CID1441939 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index ca7e9f6aba9..31de6ad7308 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -457,7 +457,8 @@ static void unpack_gray(TiffContext *s, AVFrame *p,
 GetBitContext gb;
 uint16_t *dst = (uint16_t *)(p->data[0] + lnum * p->linesize[0]);
 
-init_get_bits8(, src, width);
+int ret = init_get_bits8(, src, width);
+av_assert1(ret >= 0);
 
 for (int i = 0; i < s->width; i++) {
 dst[i] = get_bits(, bpp);
-- 
2.45.1

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

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


[FFmpeg-devel] [PATCH 1/9] avcodec/tiff: Assert init_get_bits8() success in horizontal_fill()

2024-05-17 Thread Michael Niedermayer
Helps: CID1441167 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tiff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 19301d9e490..ca7e9f6aba9 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -422,7 +422,8 @@ static void av_always_inline horizontal_fill(TiffContext *s,
 uint8_t shift = is_dng ? 0 : 16 - bpp;
 GetBitContext gb;
 
-init_get_bits8(, src, width);
+int ret = init_get_bits8(, src, width);
+av_assert1(ret >= 0);
 for (int i = 0; i < s->width; i++) {
 dst16[i] = get_bits(, bpp) << shift;
 }
-- 
2.45.1

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

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/vc1_loopfilter: Factor duplicate code in vc1_b_h_intfi_loop_filter()

2024-05-17 Thread Michael Niedermayer
On Wed, May 25, 2022 at 05:53:12PM +0200, Michael Niedermayer wrote:
> On Tue, May 24, 2022 at 08:50:51PM +0200, Andreas Rheinhardt wrote:
> > Michael Niedermayer:
> > > Fixes: CID1435168
> > > 
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/vc1_loopfilter.c | 5 +
> > >  1 file changed, 1 insertion(+), 4 deletions(-)
> > > 
> > > diff --git a/libavcodec/vc1_loopfilter.c b/libavcodec/vc1_loopfilter.c
> > > index 0f990cccef..ee694ede28 100644
> > > --- a/libavcodec/vc1_loopfilter.c
> > > +++ b/libavcodec/vc1_loopfilter.c
> > > @@ -1125,10 +1125,7 @@ static av_always_inline void 
> > > vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *d
> > >  dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) 
> > > * 8;
> > >  
> > >  if (!(flags & RIGHT_EDGE) || !(block_num & 5)) {
> > > -if (block_num > 3)
> > > -v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
> > > -else
> > > -v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
> > > +v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
> > >  }
> > >  
> > >  tt = ttblk[0] >> (block_num * 4) & 0xf;
> > 
> > Are you certain that the current code is actually correct or whether
> > something else was intended?
> 
> iam not certain no but the vc1_b_v_intfi_loop_filter() function also
> treats luma and chroma the same
> 
> if(!(flags & BOTTOM_EDGE) || block_num < 2)
> v->vc1dsp.vc1_v_loop_filter8(dst + 8 * linesize, linesize, pq);
> 
> this is just the matching function for horizontal instead of vertical
> 
> also whan looking at the 4x4 4x8 and 8x4 cases i see no difference
> between horizontal and vertical for intfi. But ultimately yes of course
> it could be buggy and something else could be correct.
> 
> but if i replace this by an abort()
> make: *** [fate-vc1_sa10143] Error 134
> make: *** [fate-vc1_ilaced_twomv] Error 134
> 
> Fate fails, so it should be tested

will apply this unless someone has some further insight in this or objection
as i just run into this again

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/tiff: Fix leak on error

2024-05-17 Thread Michael Niedermayer
On Fri, May 17, 2024 at 09:51:05PM +0200, Andreas Rheinhardt wrote:
> Fixes Coverity issue #1516957.

Please mark issues that you fixed in coverity accordingly so that others
(like me) see it and know what issues remain outstanding by well looking
at the list of outstanding issues

thx

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8()

2024-05-17 Thread Michael Niedermayer
On Fri, May 17, 2024 at 09:53:21AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1473562 Unchecked return value
> > Fixes: CID1473592 Unchecked return value
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/sga.c | 10 --
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/sga.c b/libavcodec/sga.c
> > index 0f42cf912b2..aca941e057e 100644
> > --- a/libavcodec/sga.c
> > +++ b/libavcodec/sga.c
> > @@ -254,11 +254,14 @@ static int decode_palmapdata(AVCodecContext *avctx)
> >  const int bits = (s->nb_pal + 1) / 2;
> >  GetByteContext *gb = >gb;
> >  GetBitContext pm;
> > +int ret;
> >  
> >  bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
> >  if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
> >  return AVERROR_INVALIDDATA;
> > -init_get_bits8(, gb->buffer, s->palmapdata_size);
> > +ret = init_get_bits8(, gb->buffer, s->palmapdata_size);
> > +if (ret < 0)
> > +return ret;
> >  
> >  for (int y = 0; y < s->tiles_h; y++) {
> >  uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
> > @@ -277,11 +280,14 @@ static int decode_tiledata(AVCodecContext *avctx)
> >  SGAVideoContext *s = avctx->priv_data;
> >  GetByteContext *gb = >gb;
> >  GetBitContext tm;
> > +int ret;
> >  
> >  bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
> >  if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
> >  return AVERROR_INVALIDDATA;
> > -init_get_bits8(, gb->buffer, s->tiledata_size);
> > +ret = init_get_bits8(, gb->buffer, s->tiledata_size);
> > +if (ret < 0)
> > +return ret;
> >  
> >  for (int n = 0; n < s->nb_tiles; n++) {
> >  uint8_t *dst = s->tileindex_data + n * 64;
> 
> Both of these can not fail and could be checked via av_assert1:
> palmapdata_size is given by (s->tiles_w * s->tiles_h * ((s->nb_pal + 1)
> / 2) + 7) / 8 with tiles_w and tiles_h being in the 0..255 range and
> nb_pal being in the 0..4 range.
> tiledata_size is given by s->nb_tiles * 32; nb_tiles fits in 16 bits (it
> is either read via AV_RB16 or is given as the product of tiles_h *
> tiles_w, both of which are read from simple uint8_t.

ill use av_assert1()

thx

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [RFC] STF 2025

2024-05-17 Thread Michael Niedermayer
On Fri, May 17, 2024 at 11:08:17AM -0400, Vittorio Giovara wrote:
> On Fri, May 17, 2024 at 9:50 AM Michael Niedermayer 
> wrote:
> 
> > Hi all
> >
> > Before this is forgotten again, better start some dicsussion too early
> > than too late
> >
> > I propose that if we have the oppertunity again next year to receive a
> > grant
> > from STF. That we use it to fund:
> >
> > * Paul to work on FFmpeg full time. My idea here is that he can work on
> > whatever
> >   he likes in FFmpeg (so its not full time employment for specific work but
> >   simply full time employment for him to work on whatever he likes in
> > FFmpeg any
> >   way he likes) Paul is the 2nd largest contributor to FFmpeg (git
> > shortlog -s -n)
> >
> 
> why? nothing against Paul, but this seems pretty arbitrary, and many people
> would like to be paid to do whatever they want
> if we start sponsoring people there should be clear statements of work,
> goals, and everything in between

Sure, my goal is to have the whole team payed eventually to work on FFmpeg.
Paul is the most important ATM, he is the biggest contributor who stopped
contributing.

If it would succeed to fund him. I would suggest to repeat this with more
people.

The problem with "clear goals" is that paul without any rules or goals
did work on exactly what made sense for FFmpeg, I dont think adding any
rules will make this better.


> 
> * Fund administrative / maintainance work (one example is the mailman
> > upgrade that is needed
> >   with the next OS upgrade on one of our servers (this is not as trivial
> > as one might
> >   expect). Another example here may be some git related tools if we find
> > something that
> >   theres a broad consensus about.
> >
> > * Fund maintaince on the bug tracker, try to reproduce bugs, ask users to
> > provide
> >   reproduceable cases, close bugs still unreproduceable, ...
> >   ATM we have over 2000 "new" bugs that are not even marked as open
> >
> 
> I see no mention of github/gitlab work, despite being highly requested on
> the list.
> Is it because we assume it'll be done already by next year? :)

that was supposed to be part of "git related tools"

thx

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

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [RFC] STF 2025

2024-05-17 Thread Michael Niedermayer
On Fri, May 17, 2024 at 04:26:55PM +0100, Derek Buitenhuis wrote:
> On 5/17/2024 2:49 PM, Michael Niedermayer wrote:
> > Also we need more cute girls on these events, everything i hear
> > its 100% male geeks/hackers.
> 
> This is gross and sexist.

This was definitly not meant to be either of that.

Let me reword this for 2024:
The people on the booth are predominantly male. Similarly ffmpeg-devel
is predominantly male. More gender diversity would be good.

And lets have some cute puppies and other animals on the booth as they
might attract some additional visitors.

Thx

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [RFC] STF 2025

2024-05-17 Thread Michael Niedermayer
Hi all

Before this is forgotten again, better start some dicsussion too early than too 
late

I propose that if we have the oppertunity again next year to receive a grant
from STF. That we use it to fund:

* Paul to work on FFmpeg full time. My idea here is that he can work on whatever
  he likes in FFmpeg (so its not full time employment for specific work but
  simply full time employment for him to work on whatever he likes in FFmpeg any
  way he likes) Paul is the 2nd largest contributor to FFmpeg (git shortlog -s 
-n)

* Fund administrative / maintainance work (one example is the mailman upgrade 
that is needed
  with the next OS upgrade on one of our servers (this is not as trivial as one 
might
  expect). Another example here may be some git related tools if we find 
something that
  theres a broad consensus about.

* Fund maintaince on the bug tracker, try to reproduce bugs, ask users to 
provide
  reproduceable cases, close bugs still unreproduceable, ...
  ATM we have over 2000 "new" bugs that are not even marked as open

* Fund professional real live presence on multimedia / FOSS / buisness related
  events. we already refund individuals but i think we are lacking on the 
organizational
  side. We should also have on these events at least one person who can awnser 
developer/user
  questions and someone who can awnser buisness questions (on buisness related 
events).
  Also we need some eye catching things there, a big screen/projector that 
plays some
  real time filtered version from a camera. Or maybe have more people remotely 
be available
  from the FFmpeg team through real time streaming (as in, if someone wants to 
be on some event
  but cant physically go there, we could put a notebook on the table facing 
visitors showing
  something like a video chat. Also we need more cute girls on these events, 
everything i hear
  its 100% male geeks/hackers. Also a "24/7" realtime stream from any booth 
would be nice

Thanks

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 5/5] avcodec/tests/dct: Use 64bit in intermediate for error computation

2024-05-16 Thread Michael Niedermayer
Fixes: CID1500284 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/tests/dct.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tests/dct.c b/libavcodec/tests/dct.c
index 010d0c1ac35..17a08144597 100644
--- a/libavcodec/tests/dct.c
+++ b/libavcodec/tests/dct.c
@@ -226,8 +226,8 @@ static int dct_error(const struct algo *dct, int test, int 
is_idct, int speed, c
 v = abs(err);
 if (v > err_inf)
 err_inf = v;
-err2_matrix[i] += v * v;
-err2 += v * v;
+err2_matrix[i] += v * (int64_t)v;
+err2 += v * (int64_t)v;
 sysErr[i] += block[i] - block1[i];
 blockSumErr += v;
 if (abs(block[i]) > maxout)
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 4/5] avcodec/sga: Check non constant init_get_bits8()

2024-05-16 Thread Michael Niedermayer
Fixes: CID1473562 Unchecked return value
Fixes: CID1473592 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/sga.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sga.c b/libavcodec/sga.c
index 0f42cf912b2..aca941e057e 100644
--- a/libavcodec/sga.c
+++ b/libavcodec/sga.c
@@ -254,11 +254,14 @@ static int decode_palmapdata(AVCodecContext *avctx)
 const int bits = (s->nb_pal + 1) / 2;
 GetByteContext *gb = >gb;
 GetBitContext pm;
+int ret;
 
 bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
 if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
 return AVERROR_INVALIDDATA;
-init_get_bits8(, gb->buffer, s->palmapdata_size);
+ret = init_get_bits8(, gb->buffer, s->palmapdata_size);
+if (ret < 0)
+return ret;
 
 for (int y = 0; y < s->tiles_h; y++) {
 uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
@@ -277,11 +280,14 @@ static int decode_tiledata(AVCodecContext *avctx)
 SGAVideoContext *s = avctx->priv_data;
 GetByteContext *gb = >gb;
 GetBitContext tm;
+int ret;
 
 bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
 if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
 return AVERROR_INVALIDDATA;
-init_get_bits8(, gb->buffer, s->tiledata_size);
+ret = init_get_bits8(, gb->buffer, s->tiledata_size);
+if (ret < 0)
+return ret;
 
 for (int n = 0; n < s->nb_tiles; n++) {
 uint8_t *dst = s->tileindex_data + n * 64;
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 3/5] avcodec/scpr3: Check add_dec() for failure

2024-05-16 Thread Michael Niedermayer
Fixes: CID1441459 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/scpr3.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index 79106ddcff8..45706123db0 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -465,6 +465,8 @@ static int decode_adaptive6(PixelModel3 *m, uint32_t code, 
uint32_t *value,
 return 0;
 grow_dec(m);
 c = add_dec(m, q, g, f);
+if (c < 0)
+return AVERROR_INVALIDDATA;
 }
 
 incr_cntdec(m, c);
@@ -868,11 +870,11 @@ static int decode_unit3(SCPRContext *s, PixelModel3 *m, 
uint32_t code, uint32_t
 sync_code3(gb, rc);
 break;
 case 6:
-if (!decode_adaptive6(m, code, value, , )) {
+ret = decode_adaptive6(m, code, value, , );
+if (!ret)
 ret = update_model6_to_7(m);
-if (ret < 0)
-return AVERROR_INVALIDDATA;
-}
+if (ret < 0)
+return ret;
 decode3(gb, rc, a, b);
 sync_code3(gb, rc);
 break;
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 2/5] avcodec/scpr3: unify adding 127

2024-05-16 Thread Michael Niedermayer
Untested, i have no testcase nor does fate

Signed-off-by: Michael Niedermayer 
---
 libavcodec/scpr3.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/scpr3.c b/libavcodec/scpr3.c
index 5271717ac79..79106ddcff8 100644
--- a/libavcodec/scpr3.c
+++ b/libavcodec/scpr3.c
@@ -42,7 +42,7 @@ static void renew_table3(uint32_t nsym, uint32_t *cntsum,
 freqs[d] = b;
 freqs1[d] = a;
 cnts[d] = c;
-for (int q = a + 128 - 1 >> 7, f = (a + b - 1 >> 7) + 1; q < f; q++)
+for (int q = a + 127 >> 7, f = a + b + 127 >> 7; q < f; q++)
 dectab[q] = d;
 
 a += b;
@@ -232,7 +232,7 @@ static int update_model6_to_7(PixelModel3 *m)
 cnts[j] = d;
 }
 p = (e + 127) >> 7;
-k = ((f + e - 1) >> 7) + 1;
+k = f + e + 127 >> 7;
 if (k > FF_ARRAY_ELEMS(n.dectab))
 return AVERROR_INVALIDDATA;
 for (i = 0; i < k - p; i++)
@@ -688,10 +688,10 @@ static int update_model3_to_7(PixelModel3 *m, uint8_t 
value)
 n.cntsum += n.cnts[e];
 n.freqs1[e] = c;
 g = n.freqs[e];
-f = (c + g - 1 >> 7) + 1;
+f = c + g + 127 >> 7;
 if (f > FF_ARRAY_ELEMS(n.dectab))
 return AVERROR_INVALIDDATA;
-for (q = c + 128 - 1 >> 7; q < f; q++) {
+for (q = c + 127 >> 7; q < f; q++) {
 n.dectab[q] = e;
 }
 c += g;
@@ -760,7 +760,7 @@ static int decode_value3(SCPRContext *s, uint32_t max, 
uint32_t *cntsum,
 freqs1[i] = e;
 g = (c + 127) >> 7;
 c += e;
-q = ((c - 1) >> 7) + 1;
+q = c + 127 >> 7;
 if (q > g) {
 for (int j = 0; j < q - g; j++)
 dectable[j + g] = i;
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 1/5] avcodec/rv34: assert that size is not 0 in rv34_gen_vlc_ext()

2024-05-16 Thread Michael Niedermayer
Helps: CID1548380 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/rv34.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 23a570bb807..4ce0cc58d05 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -98,6 +98,8 @@ static av_cold void rv34_gen_vlc_ext(const uint8_t *bits, int 
size, VLC *vlc,
 uint16_t cw[MAX_VLC_SIZE];
 int maxbits;
 
+av_assert0(size > 0);
+
 for (int i = 0; i < size; i++)
 counts[bits[i]]++;
 
-- 
2.43.2

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

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


Re: [FFmpeg-devel] [PATCH 1/8] aacdec: move from scalefactor ranged arrays to flat arrays

2024-05-16 Thread Michael Niedermayer
On Thu, May 16, 2024 at 12:08:11PM +0200, Lynne via ffmpeg-devel wrote:
> AAC uses an unconventional system to send scalefactors
> (the volume+quantization value for each band).
> Each window is split into either 1 or 8 blocks (long vs short),
> and transformed separately from one another, with the coefficients
> for each being also completely independent. The scalefactors
> slightly increase from 64 (long) to 128 (short) to accomodate
> better per-block-per-band volume for each window.
> 
> To reduce overhead, the codec signals scalefactor sizes in an obtuse way,
> where each group's scalefactor types are sent via a variable length decoding,
> with a range.
> But our decoder was written in a way where those ranges were carried through
> the entire decoder, and to actually read them you had to use the range.
> 
> Instead of having a dedicated array with a range for each scalefactor,
> just let the decoder directly index each scalefactor.
> 
> This also switches the form of quantized scalefactors to the format
> the spec uses, where for intensity stereo and regular, scalefactors
> are stored in a scalefactor - 100 form, rather than as-is.
> 
> USAC gets rid of the complex scalefactor handling. This commit permits
> for code sharing between both.
> ---
>  libavcodec/aac/Makefile  |   3 +-
>  libavcodec/aac/aacdec.c  | 100 ---
>  libavcodec/aac/aacdec.h  |   5 +-
>  libavcodec/aac/aacdec_dsp_template.c |  95 ++---
>  4 files changed, 85 insertions(+), 118 deletions(-)
> 
> diff --git a/libavcodec/aac/Makefile b/libavcodec/aac/Makefile
> index c3e525d373..8b0bfff3e5 100644
> --- a/libavcodec/aac/Makefile
> +++ b/libavcodec/aac/Makefile
> @@ -2,6 +2,7 @@ clean::
>   $(RM) $(CLEANSUFFIXES:%=libavcodec/aac/%)
>  
>  OBJS-$(CONFIG_AAC_DECODER)  +=  aac/aacdec.o aac/aacdec_tab.o \
> -aac/aacdec_float.o
> +aac/aacdec_float.o aac/aacdec_usac.o 
> \
> +aac/aacdec_ac.o

AR  libavcodec/libavcodec.a
ar: libavcodec/aac/aacdec_ac.o: No such file or directory
make: *** [ffbuild/library.mak:38: libavcodec/libavcodec.a] Error 1


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

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [RFC] Value analysis with Frama-C's Eva plugin (and an UB fix)

2024-05-15 Thread Michael Niedermayer
On Wed, May 15, 2024 at 09:39:43PM +0200, Tomas Härdin wrote:
> Hi
> 
> So as I said in the coverity thread it would be good if we could get at
> least part of the codebase covered using formal tools. To this effect I
> sat down for an hour just now and gave libavutil/common.h a go with
> Frama-C's Eva plugin [1;2]. This plugin performs value analysis, which
> is a much simpler analysis compared to say the weakest predicate (WP)
> plugin.
> 
> Going through the functions from top to bottom it only took until
> av_clipl_int32_c() to find my first UB, a patch for which is attached.
> Thus my harping on this has born at least some fruit.
> 
> To run the analysis implemented in this set of patches (all of which
> I've attached here because I don't want to bother writing six follow-up
> email), first install frama-c using opam. I'm using 28.0~beta (Nickel).
> Then run "make verify" in libavutil/ and Eva should tell you that 33%
> of functions are covered and 100% of statements in those functions are
> covered, with zero alarms.
> 
> If the project isn't interested in this then I'll probably continue
> fiddling with it on my own mostly as exercise. But I suspect it will
> bear even more fruit in time.

i think this is cool, especially considering


>  common.h |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> e451a7cd9a600ece22a6ee85ad7ed0c16349a411  
> 0006-lavu-common.h-Fix-UB-in-av_clipl_int32_c.patch
> From 8a535878b9f1f87ca20d5e626f2c4c098b1c948e Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
> Date: Wed, 15 May 2024 21:03:47 +0200
> Subject: [PATCH 6/7] lavu/common.h: Fix UB in av_clipl_int32_c()
> 
> ---
>  libavutil/common.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/common.h b/libavutil/common.h
> index d81131f8ad..0521ebbfc5 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -258,8 +258,8 @@ static av_always_inline av_const int16_t 
> av_clip_int16_c(int a)
>   */
>  static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
>  {
> -if ((a+0x8000u) & ~UINT64_C(0x)) return (int32_t)((a>>63) ^ 
> 0x7FFF);
> -else return (int32_t)a;
> +if ((a+UINT64_C(0x8000)) & ~UINT64_C(0x)) return 
> (int32_t)((a>>63) ^ 0x7FFF);
> +else  return (int32_t)a;
>  }

it already found something

the av_clipl_int32_c patch LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] FFMPEG support for x265 vbv-end and vbv-end-fr-adj

2024-05-15 Thread Michael Niedermayer
On Wed, May 01, 2024 at 09:10:51PM +, Tom Vaughan wrote:
> When I attempt to pass vbv-end and vbv-end-fr-adj parameters to x265, FFMPEG 
> fails.
> 
> x265 [error]: vbv-end-fr-adj cannot be enabled when total number of frames is 
> unknown
> 
> x265 needs to know how many frames it is encoding so that it knows when the 
> vbv-end logic needs to kick in. In this case it would be after 96% of the 
> source video is encoded. Despite specifying a duration of 30 seconds ( -t 30 
> ) on both input and output (using a 60 second source video), x265 does not 
> know the total number of frames (but FFMPEG surely does).
> 
> ffmpeg -i test_uhdsdr_1min.mov -t 30 -an -sn -dn -c:v libx265 -b:v 12000k 
> -maxrate 8M -bufsize 18M -x265-params 
> vbv-init=0.9:vbv-end=0.9:vbv-end-fr-adj=.96:rc-lookahead=48:qg-size=32:scenecut=0:no-open-gop=1:frame-threads=0:repeat-headers=1:nr-inter=400:nr-intra=100:psy-rd=0:cbqpoffs=0:crqpoffs=3
>  -t 30 test_uhdsdr_96.mp4

you can specify total_frames along with vbv-end-fr

there is in general not a 1:1 correspondance between duration and the number of 
frames
the frame rate may vary, there may be skiped frames or damaged frames that
where lost and so on.

in case of some 2 pass mode it should be possible to get the exact number of 
frames
in the 2nd pass.
Otherwise my gut feelng is that a time based instead of a frame number based
threshold would have been easier to work with

if you are thinking that the total frame number should be set automatically
and not by hand. I agree, its just not easy to do that in all cases.
It could maybe be done in specific cases but in the general case
it would need 2 passes to be reliable.

thx

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [WIP] False positives on Coverity

2024-05-13 Thread Michael Niedermayer
Hi all

To keep people updated (and as this is not vissible on the ML)
heres my current list of issues marked as false positives / intentional in Mai 
& April 2024
(in case anyone wants to review, i presume noone wants but just in case)

1409917 Unintentional integer overflow   No overflow happens as dimensions and 
sprite accuracy are too limited
1409920 Unintentional integer overflow   The involved variables are too 
restricted for overflow
1416963 Unintentional integer overflow   No overflow happens as bytes of an 
image are addressible by int
1417663 Uninitialized scalar variablepar_m_source is 0..3 and mid is 
initialized
1419522 Unintentional integer overflow   No overflow can happen, the values are 
too restricted
1419833 Untrusted loop bound The loop bound is limited to 65535
I also submit a patch to check the 2nd case better
1500345 Uninitialized scalar variableNot a bugf strictly but bad practice 
and fix submitted
1503083 Uninitialized pointer read   nb_channels is non negative, coverity 
assumes it could be negative
1452594 Free of array-typed valuepassed flags are 0 but assumed by coverity 
to be non 0
1452451 Use after free   coverity assumes FLAGS has values it does 
not
1452474 Use after free   coverity assumes FLAGS has values it does 
not
1452532 Use after free   coverity assumes FLAGS has values it does 
not
1524728 Free of array-typed valuecoverity assumes 0 (flags) is not 0
1591440 Free of array-typed valuecoverity assumes 0 (flags) is not 0
1452617 Free of array-typed value coverity assumes AV_DICT_DONT_STRDUP_KEY 
but that is not set
1520670 Dereference after null check  either frame or pkt is NULL
1524701 Free of array-typed value coverity assumes flags to be non 0 while 
it is 0
1538859 Dereference after null check  frame is always non-NULL for audio and 
video
1596536 Dereference null return value  There should be a descriptor for every 
type that is used
1518989 Missing break in switch  no break is intentional
1559177 Resource leakav_fifo_write() either succeeds or the 
frame is freed
1559181 Resource leakav_fifo_write() either succeeds or the 
frame is freed
1596530 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1516444 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1524729 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1596628 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1452412 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1452415 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1452551 Free of array-typed valuecoverity assumes flags to be a value it is 
not
1559186 Resource leakThe value is stored by  av_fifo_write() 
and thus not lost
1452419 Free of array-typed valuecoverity assumes flags to be non 0 while 
it is 0
1452457 Missing break in switch  this looks intentional
1500328 Resource leakpacket_queue_put_private() either stores 
pkt1 or it fails and its freed
1452606 Free of array-typed valuecoverity assumes AV_DICT_DONT_STRDUP_VAL 
is set while it is not
1551681 Data race condition  The mutex is in the caller
1475938 Uninitialized array index readall of dither seems to be intiialized
1465483 Unintentional integer overflow  the clip limits len
1473539 Explicit null dereferenced  new_rematrixing_strategy is always set for 
block 0
1596532 Copy of overlapping memory  num_blocks ia positive so the loop does at 
least one iteration
1500322 Out-of-bounds read  the mode is simply not possible
1473499 Uninitialized scalar variable  the default case seems unreachable
1595709 Uninitialized scalar variable  num_uv_points cannot be set when 
predict_uv_scaling is uninitialized
1595705 Uninitialized scalar variable  the parts of scaling used and initialized
1595706 Uninitialized scalar variable  the parts of scaling used and initialized
1595707 Unintended sign extension  the array is not gb sized, the shift is not 
nearly that large
1467648 Untrusted loop bound  loop bound is 16bit and thus bound by 65535, its 
also bound by the data length
1504415 Untrusted value as argument  av_grow_packet() will allocate a buffer 
matching the value or it will fail
1545117 Division or modulo by zero   coverity assumes the loop never executes 
but thats not currently possible
1473510 Untrusted loop bound   the read values are checked when they are read
1507875 Untrusted array index read  seq_parameter_set_id is checked when read 
(also coverity seems to have alot of problems with the multiple layers of 
macros and functions in the CBS system)
1452623 Free of address-of expression  coverity fails to keep track of 
data_ref/data_buf
1458177 Free of address-of expression  coverity assumes data_ref is NULL
1465491 Unintentional 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/flac_parser: Assert that we do not overrun the link_penalty array

2024-05-13 Thread Michael Niedermayer
On Mon, May 13, 2024 at 10:45:16PM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: CID1454676 Out-of-bounds read
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/flac_parser.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
> > index 47904d515a6..d9c47801f83 100644
> > --- a/libavcodec/flac_parser.c
> > +++ b/libavcodec/flac_parser.c
> > @@ -518,6 +518,8 @@ static int check_header_mismatch(FLACParseContext  *fpc,
> >  for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS && curr != child; i++)
> >  curr = curr->next;
> >  
> > +av_assert0(i < FLAC_MAX_SEQUENTIAL_HEADERS);
> > +
> >  if (header->link_penalty[i] < FLAC_HEADER_CRC_FAIL_PENALTY ||
> >  header->link_penalty[i] == FLAC_HEADER_NOT_PENALIZED_YET) {
> >  FLACHeaderMarker *start, *end;
> 
> If this is only supposed to mark an issue as invalid for the sanitizer,
> why are you adding an av_assert0 instead of av_assert1 here

The flac parser code is complex and confusing me a bit

If i would write av_assert1() then i would be saying that iam 100% sure this
is true and i certainly do not feel that confident. Thats why its av_assert0
and also why i have neither marked this in coverity a false positive nor a bug.
I was hoping posting this to the mailing list would result in either someone
confirming it to be correct or telling me that iam an idiot and that this is
wrong. And it seemed remi agreed that the change is correct so i intended to
push it but iam happy to wait if you or someone else wants to take a look

thx



> (and in
> other patches)?
> 
> - Andreas
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_slice: Remove dead sps check

2024-05-13 Thread Michael Niedermayer
On Mon, May 13, 2024 at 06:15:16AM +0100, Kieran Kunhya wrote:
> On Mon, 13 May 2024, 02:32 Michael Niedermayer, 
> wrote:
> 
> > On Mon, May 06, 2024 at 03:23:07AM +0200, Michael Niedermayer wrote:
> > > Fixes: CID1439574 Dereference after null check
> > >
> > > Sponsored-by: Sovereign Tech Fund
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/h264_slice.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > will apply
> >
> 
> I don't understand what this fixes

it is not possible for sps to be NULL in this function (see line 1424)

thanks

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/jpeg2000dec: remove ST=3 case

2024-05-13 Thread Michael Niedermayer
On Mon, May 13, 2024 at 10:35:44AM +0200, Tomas Härdin wrote:
> fre 2024-05-10 klockan 16:07 +0200 skrev Michael Niedermayer:
> > Fixes: CID1460979 Logically dead code
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/jpeg2000dec.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 28bf6be2fef..135537b52fb 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -835,9 +835,6 @@ static int get_tlm(Jpeg2000DecoderContext *s, int
> > n)
> >  case 2:
> >  bytestream2_get_be16(>g);
> >  break;
> > -    case 3:
> > -    bytestream2_get_be32(>g);
> > -    break;
> 
> Double-checked T.800 table A.34 and indeed ST == 3 is invalid (which is
> also checked just above). So looks OK.

will apply

thx

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/flac_parser: Assert that we do not overrun the link_penalty array

2024-05-13 Thread Michael Niedermayer
Hi

On Mon, May 13, 2024 at 09:07:50AM +0300, Rémi Denis-Courmont wrote:
> 
> 
> Le 5 mai 2024 02:51:59 GMT+03:00, Michael Niedermayer 
>  a écrit :
> >Fixes: CID1454676 Out-of-bounds read
> 
> It's a stretch to call this "fixing". It just asserts that the situation 
> doesn't happen,

yes


> in other words, that it is a false positive from the static analyser.

thanks for reviewing


> 
> The code change looks OK, but the commit description seems misleading.

will apply with "Helps: CID1454676 Out-of-bounds read" instead if "Fixing: ..."

thx

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_slice: Remove dead sps check

2024-05-13 Thread Michael Niedermayer
On Mon, May 13, 2024 at 09:04:34AM +0300, Rémi Denis-Courmont wrote:
> 
> 
> Le 6 mai 2024 04:23:07 GMT+03:00, Michael Niedermayer 
>  a écrit :
> >Fixes: CID1439574 Dereference after null check
> 
> If SPS is guaranteed to be non-NULL, there should probably be an assertion to 
> document it, and it should be *before* that alleged dereference (which is not 
> visible in the patch context).

why ?

I mean why would sps require an assert*(sps) but the overwhelming majority
of pointers, we just dereference without assert before them ?

thx

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

Observe your enemies, for they first find out your faults. -- Antisthenes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/2] libavutil/base64: Try not to write over the array end

2024-05-12 Thread Michael Niedermayer
On Sat, May 11, 2024 at 03:22:53AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavutil/base64.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

will apply patchset

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] MAINTAINERS: add myself as *BSD maintainer

2024-05-12 Thread Michael Niedermayer
On Sat, May 11, 2024 at 08:33:06PM -0400, Brad Smith wrote:
> MAINTAINERS: add myself as *BSD maintainer
> 
> I try to help out with *BSD patches or build related issues where I can.
> 
> Signed-off-by: Brad Smith 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)

will apply

thx

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

Homeopathy is like voting while filling the ballot out with transparent ink.
Sometimes the outcome one wanted occurs. Rarely its worse than filling out
a ballot properly.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/decode: decode_simple_internal() only implements audio and video

2024-05-12 Thread Michael Niedermayer
On Fri, May 03, 2024 at 11:54:58PM +0200, Michael Niedermayer wrote:
> Fixes: CID1538861 Uninitialized scalar variable
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/decode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply what remains from this patchset

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/fmvc: remove dead assignment

2024-05-12 Thread Michael Niedermayer
On Sun, May 05, 2024 at 01:52:00AM +0200, Michael Niedermayer wrote:
> Fixes: CID1529220 Unused value
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/fmvc.c | 1 -
>  1 file changed, 1 deletion(-)

will apply

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_slice: Remove dead sps check

2024-05-12 Thread Michael Niedermayer
On Mon, May 06, 2024 at 03:23:07AM +0200, Michael Niedermayer wrote:
> Fixes: CID1439574 Dereference after null check
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h264_slice.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

What does censorship reveal? It reveals fear. -- Julian Assange


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec/h2645_sei: Remove dead checks

2024-05-12 Thread Michael Niedermayer
On Mon, May 06, 2024 at 02:38:45AM +0200, Michael Niedermayer wrote:
> Fixes: CID1596534 Dereference after null check
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/h2645_sei.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)

will apply

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/lpc: copy levenson coeffs only when they have been computed

2024-05-12 Thread Michael Niedermayer
On Sun, May 12, 2024 at 02:29:57AM +0200, Lynne via ffmpeg-devel wrote:
> On 12/05/2024 02:18, Michael Niedermayer wrote:
> > On Sun, May 12, 2024 at 02:13:06AM +0200, Lynne via ffmpeg-devel wrote:
> > > On 12/05/2024 02:03, Michael Niedermayer wrote:
> > > > Fixes: CID1473514 Uninitialized scalar variable
> > > > 
> > > > Sponsored-by: Sovereign Tech Fund
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >libavcodec/lpc.c | 5 +++--
> > > >1 file changed, 3 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
> > > > index 8305cc0596a..981dacce8a5 100644
> > > > --- a/libavcodec/lpc.c
> > > > +++ b/libavcodec/lpc.c
> > > > @@ -282,8 +282,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
> > > >double av_uninit(weight);
> > > >memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
> > > > -for(j=0; j > > > -m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
> > > > +if (lpc_passes > 1)
> > > > +for(j=0; j > > > +m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
> > > >for(; pass > > >avpriv_init_lls([pass&1], max_order);
> > > 
> > > max_order is a function argument, I don't think that's the right place to
> > > fix this.
> > 
> > max_orders is fine
> > 
> > what the problem is, is that CHOLESKY with lpc_passes = 1
> > skips the first pass LEVINSON but this line copies the output
> > from LEVINSON so it copies Uninitialized data.
> > a few lines later thats cleared with avpriv_init_lls()
> > but that access to uninitialized data i think is undefined behavior
> > 
> > if my analysis is not wrong then i think my fix is correct
> > 
> > thx
> > 
> > [...]
> > 
> > 
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> Ah, I see. Could you put a small comment above, like:
> /* Avoids initializing with an unused value when max_order == 1 */?
> Other than that looks fine.

ok, will apply with such note

thx

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

There will always be a question for which you do not know the correct answer.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 4/4] avcodec/qsvdec: Check av_image_get_buffer_size() for failure

2024-05-12 Thread Michael Niedermayer
Fixes: CID1477406 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/qsvdec.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index ed0bfe4c8b8..a51ddace622 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -379,9 +379,12 @@ static int qsv_decode_init_context(AVCodecContext *avctx, 
QSVContext *q, mfxVide
 
 q->frame_info = param->mfx.FrameInfo;
 
-if (!avctx->hw_frames_ctx)
-q->pool = av_buffer_pool_init(av_image_get_buffer_size(avctx->pix_fmt,
-FFALIGN(avctx->width, 128), FFALIGN(avctx->height, 64), 
1), av_buffer_allocz);
+if (!avctx->hw_frames_ctx) {
+ret = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 
128), FFALIGN(avctx->height, 64), 1);
+if (ret < 0)
+return ret;
+q->pool = av_buffer_pool_init(ret, av_buffer_allocz);
+}
 return 0;
 }
 
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 3/4] avcodec/proresenc_anatoliy: Assert that AV_PROFILE_UNKNOWN is replaced

2024-05-12 Thread Michael Niedermayer
If its not replaced we would have a negative index used in an array potentially

Helps: CID1440385 Negative array index read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/proresenc_anatoliy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 2fb96e9cf56..8709f400d04 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -857,7 +857,8 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
 avctx->profile = AV_PROFILE_PRORES_;
 av_log(avctx, AV_LOG_INFO,
"encoding with ProRes + (ap4h) profile\n");
-}
+} else
+av_assert0(0);
 } else if (avctx->profile < AV_PROFILE_PRORES_PROXY
 || avctx->profile > AV_PROFILE_PRORES_XQ) {
 av_log(
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 2/4] avcodec/pcm-dvdenc: 64bit pkt-size

2024-05-12 Thread Michael Niedermayer
It seems nothing prevents such overflow even though odd

Fixes: CID1441934 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/pcm-dvdenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index 1e7ee644f66..71e9b6915ad 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -116,7 +116,7 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 {
 PCMDVDContext *s = avctx->priv_data;
 int samples = frame->nb_samples * avctx->ch_layout.nb_channels;
-int64_t pkt_size = (frame->nb_samples / s->samples_per_block) * 
s->block_size + 3;
+int64_t pkt_size = (int64_t)(frame->nb_samples / s->samples_per_block) * 
s->block_size + 3;
 int blocks = (pkt_size - 3) / s->block_size;
 const int16_t *src16;
 const int32_t *src32;
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 1/4] avcodec/notchlc: Check init_get_bits8() for failure

2024-05-12 Thread Michael Niedermayer
Fixes: CID1500300 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/notchlc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 6dd3f884407..30427f4ba92 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -243,7 +243,9 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p,
 
 bytestream2_seek(, s->y_data_offset + row_offset, SEEK_SET);
 
-init_get_bits8(, dgb.buffer, bytestream2_get_bytes_left());
+ret = init_get_bits8(, dgb.buffer, 
bytestream2_get_bytes_left());
+if (ret < 0)
+return ret;
 for (int x = 0; x < avctx->width; x += 4) {
 unsigned item = bytestream2_get_le32(gb);
 unsigned y_min = item & 4095;
-- 
2.43.2

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

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


Re: [FFmpeg-devel] [PATCH v2 40/71] avcodec/mpegvideo_enc: Move copying properties to alloc_picture()

2024-05-12 Thread Michael Niedermayer
On Sat, May 11, 2024 at 10:51:04PM +0200, Andreas Rheinhardt wrote:
> This way said function sets everything (except for the actual
> contents of the frame's data). Also rename it to prepare_picture()
> given its new role.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/mpegvideo_enc.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)

changes output for:

make -j32 && ./ffmpeg -y -i mm-short.mpg -qmin 1 -qmax 8 -vtag mx3p -vcodec 
mpeg2video -r 25 -pix_fmt yuv422p -minrate 3k -maxrate 3k -b 3k -g 
1 -flags +ildct+low_delay -dc 10  -ps 1 -qmin 1 -qmax 8 -top 1 -bufsize 120 
-lmin QP2LAMBDA -t 2 -an -bitexact /tmp/file-qp1-hq-old.mpg

md5sum /tmp/file-qp1-hq-old.mpg /tmp/file-qp1-hq.mpg
dee0a5b29d2fbb63060ed43668db0df0  /tmp/file-qp1-hq-old.mpg
86c3ed0ec7a948e32888a75439ae  /tmp/file-qp1-hq.mpg

did not investigate why

thx

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/5] avcodec/lpc: copy levenson coeffs only when they have been computed

2024-05-11 Thread Michael Niedermayer
On Sun, May 12, 2024 at 02:13:06AM +0200, Lynne via ffmpeg-devel wrote:
> On 12/05/2024 02:03, Michael Niedermayer wrote:
> > Fixes: CID1473514 Uninitialized scalar variable
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Michael Niedermayer 
> > ---
> >   libavcodec/lpc.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
> > index 8305cc0596a..981dacce8a5 100644
> > --- a/libavcodec/lpc.c
> > +++ b/libavcodec/lpc.c
> > @@ -282,8 +282,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
> >   double av_uninit(weight);
> >   memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
> > -for(j=0; j > -m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
> > +if (lpc_passes > 1)
> > +for(j=0; j > +m[0].coeff[max_order-1][j] = -lpc[max_order-1][j];
> >   for(; pass >   avpriv_init_lls([pass&1], max_order);
> 
> max_order is a function argument, I don't think that's the right place to
> fix this.

max_orders is fine

what the problem is, is that CHOLESKY with lpc_passes = 1
skips the first pass LEVINSON but this line copies the output
from LEVINSON so it copies Uninitialized data.
a few lines later thats cleared with avpriv_init_lls()
but that access to uninitialized data i think is undefined behavior

if my analysis is not wrong then i think my fix is correct

thx

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD

2024-05-11 Thread Michael Niedermayer
Hi

On Sat, May 11, 2024 at 06:24:32PM -0400, Brad Smith wrote:
> On 2024-05-11 5:49 p.m., Michael Niedermayer wrote:
> > On Sat, May 11, 2024 at 03:55:44PM -0400, Brad Smith wrote:
> > > On 2024-05-06 10:24 p.m., Michael Niedermayer wrote:
> > > > On Sun, May 05, 2024 at 11:21:58PM -0400, Brad Smith wrote:
> > > > > avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
> > > > > 
> > > > > Use the machdep.altivec sysctl on NetBSD for AltiVec detection
> > > > > as is done with OpenBSD.
> > > > > 
> > > > > Signed-off-by: Brad Smith
> > > > > ---
> > > > >libavutil/ppc/cpu.c | 6 +++---
> > > > >1 file changed, 3 insertions(+), 3 deletions(-)
> > > > you seem to be sending alot of bsd related patches, maybe
> > > > you want to send a patch that adds you to the MAINTAINERs file?
> > > > 
> > > > thx
> > > I try to help where I can. I am an OpenBSD developer and take a look at
> > > what the other *BSD's have for local patches and push things upstream to
> > > benefit both sides, but I am not sure I have enough time to be in a 
> > > position
> > > to be considered any kind of official MAINTAINER.
> > Iam not asking you to do more work
> > Id like to give you a git write account so you can push your BSD related
> > fixes yourself.
> > (everyone who has git write should be in MAINTAINERs)
> > 
> > thx
> 
> Oh, my misunderstanding. I would be fine with that.

Than please post a patch that adds you to MAINTAINERs
the idea behind this is so that teh whole community can always
object anyone receiving git wriet access
I can post a patch adding you too, but i dont know what exactly
you want listed in it. For git write it just matters that you are
in the file anywhere

thx


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

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 5/5] avcodec/mscc & mwsc: Check loop counts before use

2024-05-11 Thread Michael Niedermayer
This could cause timeouts

Fixes: CID1439568 Untrusted loop bound

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mscc.c |  6 ++
 libavcodec/mwsc.c | 11 +++
 2 files changed, 17 insertions(+)

diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index 39bfad0b989..0c11fa08a24 100644
--- a/libavcodec/mscc.c
+++ b/libavcodec/mscc.c
@@ -54,6 +54,9 @@ static int rle_uncompress(AVCodecContext *avctx, 
GetByteContext *gb, PutByteCont
 unsigned run = bytestream2_get_byte(gb);
 
 if (run) {
+if (bytestream2_get_bytes_left_p(pb) < run * s->bpp)
+return AVERROR_INVALIDDATA;
+
 switch (avctx->bits_per_coded_sample) {
 case 8:
 fill = bytestream2_get_byte(gb);
@@ -102,6 +105,9 @@ static int rle_uncompress(AVCodecContext *avctx, 
GetByteContext *gb, PutByteCont
 
 bytestream2_seek_p(pb, y * avctx->width * s->bpp + x * s->bpp, 
SEEK_SET);
 } else {
+if (bytestream2_get_bytes_left_p(pb) < copy * s->bpp)
+return AVERROR_INVALIDDATA;
+
 for (j = 0; j < copy; j++) {
 switch (avctx->bits_per_coded_sample) {
 case 8:
diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c
index 06a151a72af..0d4ee9791ad 100644
--- a/libavcodec/mwsc.c
+++ b/libavcodec/mwsc.c
@@ -51,6 +51,10 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 
 if (run == 0) {
 run = bytestream2_get_le32(gb);
+
+if (bytestream2_tell_p(pb) + width - w < run)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < run; j++, w++) {
 if (w == width) {
 w = 0;
@@ -62,6 +66,10 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 int pos = bytestream2_tell_p(pb);
 
 bytestream2_seek(gbp, pos, SEEK_SET);
+
+if (pos + width - w < fill)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < fill; j++, w++) {
 if (w == width) {
 w = 0;
@@ -73,6 +81,9 @@ static int rle_uncompress(GetByteContext *gb, PutByteContext 
*pb, GetByteContext
 
 intra = 0;
 } else {
+if (bytestream2_tell_p(pb) + width - w < run)
+return AVERROR_INVALIDDATA;
+
 for (int j = 0; j < run; j++, w++) {
 if (w == width) {
 w = 0;
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 4/5] avcodec/mpegvideo_enc: Fix potential overflow in RD

2024-05-11 Thread Michael Niedermayer
Fixes: CID1500285 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mpegvideo_enc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b601a1a9e40..73a9082265b 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1433,7 +1433,7 @@ static int estimate_best_b_count(MpegEncContext *s)
 goto fail;
 }
 
-rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
+rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
 }
 
 /* get the delayed frames */
@@ -1442,7 +1442,7 @@ static int estimate_best_b_count(MpegEncContext *s)
 ret = out_size;
 goto fail;
 }
-rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
+rd += (out_size * (uint64_t)lambda2) >> (FF_LAMBDA_SHIFT - 3);
 
 rd += c->error[0] + c->error[1] + c->error[2];
 
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 3/5] avcodec/mpeg4videodec: assert impossible wrap points

2024-05-11 Thread Michael Niedermayer
Helps: CID1473517 Uninitialized scalar variable
Helps: CID1473497 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mpeg4videodec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 6a7a37e8171..df1e22207db 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -597,6 +597,8 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext 
*ctx, GetBitContext *g
 ctx->sprite_shift[0]  = alpha + beta + rho - min_ab;
 ctx->sprite_shift[1]  = alpha + beta + rho - min_ab + 2;
 break;
+default:
+av_assert0(0);
 }
 /* try to simplify the situation */
 if (sprite_delta[0][0] == a << ctx->sprite_shift[0] &&
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 2/5] avcodec/mpeg12dec: Use 64bit in bit computation

2024-05-11 Thread Michael Niedermayer
I dont think this can actually overflow but 64bit seems reasonable to use

Fixes: CID1521983 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mpeg12dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 21a214ef5b7..e257889d034 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2734,7 +2734,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 int ret;
 
 // Check for minimal intra MB size (considering mb header, luma & chroma 
dc VLC, ac EOB VLC)
-if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 
+ 3*4 + 2*2 + 2*6))
+if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * 
(2LL + 3*4 + 2*2 + 2*6))
 return AVERROR_INVALIDDATA;
 
 ret = ff_get_buffer(avctx, frame, 0);
-- 
2.43.2

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

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


[FFmpeg-devel] [PATCH 1/5] avcodec/lpc: copy levenson coeffs only when they have been computed

2024-05-11 Thread Michael Niedermayer
Fixes: CID1473514 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer 
---
 libavcodec/lpc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 8305cc0596a..981dacce8a5 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -282,8 +282,9 @@ int ff_lpc_calc_coefs(LPCContext *s,
 double av_uninit(weight);
 memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
 
-for(j=0; j 1)
+for(j=0; jhttps://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD

2024-05-11 Thread Michael Niedermayer
On Sat, May 11, 2024 at 03:55:44PM -0400, Brad Smith wrote:
> On 2024-05-06 10:24 p.m., Michael Niedermayer wrote:
> > On Sun, May 05, 2024 at 11:21:58PM -0400, Brad Smith wrote:
> > > avutil/ppc/cpu: Also use the machdep.altivec sysctl on NetBSD
> > > 
> > > Use the machdep.altivec sysctl on NetBSD for AltiVec detection
> > > as is done with OpenBSD.
> > > 
> > > Signed-off-by: Brad Smith
> > > ---
> > >   libavutil/ppc/cpu.c | 6 +++---
> > >   1 file changed, 3 insertions(+), 3 deletions(-)
> > you seem to be sending alot of bsd related patches, maybe
> > you want to send a patch that adds you to the MAINTAINERs file?
> > 
> > thx
> 
> I try to help where I can. I am an OpenBSD developer and take a look at
> what the other *BSD's have for local patches and push things upstream to
> benefit both sides, but I am not sure I have enough time to be in a position
> to be considered any kind of official MAINTAINER.

Iam not asking you to do more work
Id like to give you a git write account so you can push your BSD related
fixes yourself.
(everyone who has git write should be in MAINTAINERs)

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 4/4] avfilter/vf_geq: fix interpolation with 1 pixel width/height

2024-05-10 Thread Michael Niedermayer
On Thu, May 09, 2024 at 08:49:18AM +0200, Marton Balint wrote:
> Fixes ticket #9740.
> 
> Signed-off-by: Marton Balint 
> ---
>  libavfilter/vf_geq.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
> index dbe50e5250..12604d44a2 100644
> --- a/libavfilter/vf_geq.c
> +++ b/libavfilter/vf_geq.c
> @@ -112,8 +112,12 @@ static inline double getpix(void *priv, double x, double 
> y, int plane)
>  return 0;
>  
>  if (geq->interpolation == INTERP_BILINEAR) {
> -xi = x = av_clipd(x, 0, w - 2);
> -yi = y = av_clipd(y, 0, h - 2);
> +int xn, yn;
> +
> +xi = x = av_clipd(x, 0, w - 1);
> +yi = y = av_clipd(y, 0, h - 1);
> +xn = av_clip(xi + 1, 0, w - 1);
> +yn = av_clip(yi + 1, 0, h - 1);

xi + 1 should not need cliping, a FFMIN() should be enough

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avformat/data_uri: Fix base64 decode buffer size calculation

2024-05-10 Thread Michael Niedermayer
On Thu, May 09, 2024 at 04:02:09PM +0200, Kacper Michajłow wrote:
> Also reject input if it is too short.
> 
> Found by OSS-Fuzz.
> 
> Signed-off-by: Kacper Michajłow 
> ---
>  libavformat/data_uri.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/data_uri.c b/libavformat/data_uri.c
> index 3868a19630..f97ecbab37 100644
> --- a/libavformat/data_uri.c
> +++ b/libavformat/data_uri.c
> @@ -73,11 +73,11 @@ static av_cold int data_open(URLContext *h, const char 
> *uri, int flags)
>  data++;
>  in_size = strlen(data);
>  if (base64) {
> -size_t out_size = 3 * (in_size / 4) + 1;
> +size_t out_size = AV_BASE64_DECODE_SIZE(in_size);

i suspect this is correct


>  
>  if (out_size > INT_MAX || !(ddata = av_malloc(out_size)))
>  return AVERROR(ENOMEM);

> -if ((ret = av_base64_decode(ddata, data, out_size)) < 0) {
> +if (!out_size || (ret = av_base64_decode(ddata, data, out_size)) < 
> 0) {
>  av_free(ddata);
>  av_log(h, AV_LOG_ERROR, "Invalid base64 in URI\n");
>  return ret;

why would this need a out_size == 0 check ?

also it seems av_base64_decode() itself is buggy, ive sent 2 patches
fixing av_base64_decode() and extening the self tests

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


  1   2   3   4   5   6   7   8   9   10   >