Re: [FFmpeg-devel] [PATCH v8 13/18] swscale/ops_backend: add reference backend basend on C templates

2025-07-13 Thread Andreas Rheinhardt
Niklas Haas: > From: Niklas Haas > > This will serve as a reference for the SIMD backends to come. That said, > with auto-vectorization enabled, the performance of this is not atrocious. > It easily beats the old C code and sometimes even the old SIMD. > > In theory, we can dramatically speed it

Re: [FFmpeg-devel] [PATCH v8 06/18] swscale: add SWS_UNSTABLE flag

2025-07-13 Thread Andreas Rheinhardt
Niklas Haas: > From: Niklas Haas > > Give users and developers a way to opt in to the new format conversion code, > and more code from the swscale rewrite in general, even while development is > still ongoing. > --- > doc/APIchanges | 3 +++ > doc/scaler.texi | 4 > libswscale/op

Re: [FFmpeg-devel] [PATCH v8 07/18] swscale/ops: introduce new low level framework

2025-07-13 Thread Andreas Rheinhardt
Niklas Haas: > From: Niklas Haas > > See docs/swscale-v2.txt for an in-depth introduction to the new approach. > > This commit merely introduces the ops definitions and boilerplate functions. > The subsequent commits will flesh out the underlying implementation. > --- > libswscale/Makefile |

Re: [FFmpeg-devel] [PATCH v2 12/13] lavc/vp9dec: use cbs_vp9 to parse the frame header

2025-07-13 Thread Andreas Rheinhardt
Lynne: > --- > configure | 2 +- > libavcodec/vp9.c | 40 > libavcodec/vp9dec.h| 6 ++ > libavcodec/vp9shared.h | 4 > 4 files changed, 51 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index eeb81d

Re: [FFmpeg-devel] [PATCH 5/5] avcodec/osq: Fix 32bit sample overflow

2025-07-13 Thread Andreas Rheinhardt
Michael Niedermayer: > Fixes: signed integer overflow: 2147483565 + 128 cannot be represented in > type 'int' > Fixes: > 428055715/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6358069900804096 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/mas

Re: [FFmpeg-devel] [PATCH 4/5] avcodec/mpegvideo_dec: Fix lowres=3 field select interlaced mpeg4 frame

2025-07-13 Thread Andreas Rheinhardt
Michael Niedermayer: > Fixes: out of array read in the chroma plane > Fixes: > 428034092/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_DEC_fuzzer-5582608941776896.test > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off

Re: [FFmpeg-devel] [PATCH 0/4] Crc crash

2025-07-13 Thread Andreas Rheinhardt
ffmpegagent: > The main aim of this patchset is to fix ticket 11233. > > Andreas Rheinhardt (4): > avformat/aviobuf: Keep checksum_ptr consistent in avio_seek() > avformat/oggdec: Don't skip over data whose checksum is used > avformat/tta: Avoid seek when reading hea

Re: [FFmpeg-devel] [PATCH 0/5] Encode checks

2025-07-13 Thread Andreas Rheinhardt
ffmpegagent: > Mostly removal of dead encode checks. > > Andreas Rheinhardt (5): > avcodec/av1dec,libdav1d,wbmpdec: Avoid direct access to GetByteContext > avcodec/encode: Simplify pixel format validity check > avcodec/encode: Ignore coded_{width,height} > avcodec/enc

[FFmpeg-devel] [PATCH 4/4] avformat/takdec: Don't truncate return value

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This is unlikely to matter for real files. Signed-off-by: Andreas Rheinhardt --- libavformat/takdec.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/takdec.c b/libavformat/takdec.c index b8f76aaa67..c1271601b5 100644 --- a

[FFmpeg-devel] [PATCH 3/4] avformat/tta: Avoid seek when reading header

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavformat/tta.c | 41 +++-- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/libavformat/tta.c b/libavformat/tta.c index fdc18216c8..6e3c3a0007 100644 --- a/libavformat/tta.c

[FFmpeg-devel] [PATCH 2/4] avformat/oggdec: Don't skip over data whose checksum is used

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt The behavior of the ffio_*_checksum feature is not well defined when using avio_skip(). The code in oggdec.c relied on the skipped data (four bytes) to be checksummed, which is mostly true because short_seek_threshold is 32768 by default, so that avio_seek() will

[FFmpeg-devel] [PATCH 1/4] avformat/aviobuf: Keep checksum_ptr consistent in avio_seek()

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Otherwise it might be > buf_ptr in which case ffio_get_checksum() could segfault (s->buf_ptr - s->checksum_ptr would be negative which would be converted to something very big when converted to unsigned for the update_checksum callback). Fixes ticket #11233.

[FFmpeg-devel] [PATCH 5/5] avcodec/encode: Remove redundant av_image_check_size2()

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt The dimensions have already been checked during init. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 4 1 file changed, 4 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 2f789c5b7a..c12cb1aa09 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 4/5] avcodec/encode: Remove dead code

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Can be readded if needed (likely never). Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 0308c73630..2f789c5b7a 100644

[FFmpeg-devel] [PATCH 3/5] avcodec/encode: Ignore coded_{width, height}

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It is supposed to be unused by encoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index b9782a0581..0308c73630 100644 --- a/libavcodec

[FFmpeg-devel] [PATCH 2/5] avcodec/encode: Simplify pixel format validity check

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 38833c566c..b9782a0581 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -551,7

[FFmpeg-devel] [PATCH 1/5] avcodec/av1dec, libdav1d, wbmpdec: Avoid direct access to GetByteContext

2025-07-11 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/av1dec.c | 2 +- libavcodec/libdav1d.c | 2 +- libavcodec/wbmpdec.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 8ff1bf394c..dcbe4ef2ce 100644

Re: [FFmpeg-devel] [PATCH 0/4] Get bits buffer end

2025-07-07 Thread Andreas Rheinhardt
ffmpegagent: > This patchset eliminates GetBitContext.buffer_end (which is mostly unused). > It therefore automatically fixes the UB that happens upon init_get_bits() > failure (when using pre-C23). > > Andreas Rheinhardt (4): > avcodec/bytestream: Add const where appropria

Re: [FFmpeg-devel] [PATCH 2/2] avformat/rtsp: add TLS options

2025-07-07 Thread Andreas Rheinhardt
Marvin Scholz: > From: Daniel N Pettersson > > Add TLS options to RTSP for when TLS is used for the lower protocol. > > Signed-off-by: Marvin Scholz > Co-authored-by: Marvin Scholz > --- > libavformat/rtsp.c | 26 +- > libavformat/rtsp.h | 11 +++ > 2 files cha

Re: [FFmpeg-devel] [PATCH 0/4] Opus

2025-07-07 Thread Andreas Rheinhardt
ffmpegagent: > This main aim of this patchset designed to fix the UB in opus-testvector02 > without adding branches. > > Andreas Rheinhardt (4): > avcodec/opus/dec: Don't use outdated size > avcodec/opus/dec: Remove unused parameters > avcodec/opus/dec: Don't

Re: [FFmpeg-devel] [PATCH] avcodec/adpcm: squelch uninitialized variable warnings

2025-07-07 Thread Andreas Rheinhardt
Peter Ross: > Fixes CID1655273 and CID1655274. > --- > libavcodec/adpcm.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > index 92ab248f3d..527384b86d 100644 > --- a/libavcodec/adpcm.c > +++ b/libavcodec/adpcm.c > @@ -877,6 +877,9 @@ static

Re: [FFmpeg-devel] [PATCH v2 3/3] avfilter/scale_cuda: Add support for 4:2:2 chroma subsampling

2025-07-07 Thread Andreas Rheinhardt
Diego Felix de Souza via ffmpeg-devel: > +struct format_entry { > +enum AVPixelFormat format; > +const char *name; > +}; > + > +static const struct format_entry supported_formats[] = { > +{AV_PIX_FMT_YUV420P, "planar8"}, > +{AV_PIX_FMT_YUV422P, "planar8"}, > +{AV_PIX_FMT_YUV44

Re: [FFmpeg-devel] [PATCH] avutil/avstring: shrink allocation from av_get_token to fit token

2025-07-04 Thread Andreas Rheinhardt
Kacper Michajlow: > On Fri, 4 Jul 2025 at 20:22, Andreas Rheinhardt > wrote: >> >> Kacper Michajłow: >>> av_get_token() allocates an output buffer with the same size as the >>> input. Generally, this is harmless, but when the input string is large >>&g

Re: [FFmpeg-devel] [PATCH] avutil/avstring: shrink allocation from av_get_token to fit token

2025-07-04 Thread Andreas Rheinhardt
Kacper Michajłow: > av_get_token() allocates an output buffer with the same size as the > input. Generally, this is harmless, but when the input string is large > and consists of many small tokens, calling av_get_token() repeatedly to > extract all tokens will significantly amplify memory allocatio

[FFmpeg-devel] [PATCH 4/4] avcodec/get_bits: Remove GetBitContext.buffer_end

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It is unused. Furthermore, this automatically fixes the issue that init_get_bits() failure would lead to NULL + 0 (when setting buffer_end) which is UB before C23. This happened in the fic-avi and fic-avi-skip_cursor FATE-tests. This saved 7296B of .text here. Signed

[FFmpeg-devel] [PATCH 3/4] avcodec/get_bits: Add get_bits_bytesize()

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt And use it to avoid accesses to GetBitContext.buffer_end. Signed-off-by: Andreas Rheinhardt --- libavcodec/bitstream.h | 2 ++ libavcodec/bitstream_template.h | 8 libavcodec/get_bits.h | 15 +++ libavcodec/h263dec.c

[FFmpeg-devel] [PATCH 2/4] avcodec/vvc/dec: Don't use GetBit-API when byte-aligned

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/vvc/dec.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c index 7930d64a05..90fff3a03f 100644 --- a/libavcodec/vvc/dec.c

[FFmpeg-devel] [PATCH 1/4] avcodec/bytestream: Add const where appropriate

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/bytestream.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h index 67080604b9..9c13a2791b 100644 --- a/libavcodec/bytestream.h +++ b

[FFmpeg-devel] [PATCH 4/4] avcodec/opus/dec: Simplify resetting AVAudioFifo

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/opus/dec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c index b0e149e636..3118f2b99c 100644 --- a/libavcodec/opus/dec.c +++ b/libavcodec/opus

[FFmpeg-devel] [PATCH 3/4] avcodec/opus/dec: Don't call function multiple times in FFMAX

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/opus/dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/opus/dec.c b/libavcodec/opus/dec.c index 05f7a12d8e..b0e149e636 100644 --- a/libavcodec/opus/dec.c +++ b/libavcodec/opus/dec.c

[FFmpeg-devel] [PATCH 2/4] avcodec/opus/dec: Remove unused parameters

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt The parameters here are not only unused, but buf_size's value is actually wrong when flushing (it comes from the subpacket of the last packet sent and is therefore outdated). Signed-off-by: Andreas Rheinhardt --- libavcodec/opus/dec.c | 7 ++- 1 file chang

[FFmpeg-devel] [PATCH 1/4] avcodec/opus/dec: Don't use outdated size

2025-07-04 Thread Andreas Rheinhardt
From: Andreas Rheinhardt When flushing, the code would use subpacket sizes from the last proper packet sent and use this to offset the NULL buf variable which is UB (this happens in the opus-testvector02 FATE-test). This also has the potential to make buf != NULL, so that one would enter the

[FFmpeg-devel] [PATCH] avcodec/mpegvideo_dec: Avoid implicit NULL + offset

2025-07-03 Thread Andreas Rheinhardt
Patch attached. - Andreas From 1f85427ebe8ac63ba0d89c49bc0df917106753cb Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 3 Jul 2025 22:32:15 +0200 Subject: [PATCH] avcodec/mpegvideo_dec: Avoid implicit NULL + offset Happens since 4fc874ef0813d39983f9b634cec42798aa94b57a when this

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/smacker: Check input before allocation

2025-07-03 Thread Andreas Rheinhardt
Michael Niedermayer: > On Thu, Jul 03, 2025 at 09:14:42PM +0200, Andreas Rheinhardt wrote: >> Michael Niedermayer: >>> Fixes: Timeout >>> Fixes: >>> 421650030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-611767493632 >>> >&g

Re: [FFmpeg-devel] [PATCH 2/5] avcodec/smacker: Check input before allocation

2025-07-03 Thread Andreas Rheinhardt
Michael Niedermayer: > Fixes: Timeout > Fixes: > 421650030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-611767493632 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > l

Re: [FFmpeg-devel] [PATCH 05/18] avformat/whip: fix format string for printing size_t

2025-07-03 Thread Andreas Rheinhardt
Timo Rothenpieler: > On 03.07.2025 19:16, Andreas Rheinhardt wrote: >> Timo Rothenpieler: >>> --- >>>   libavformat/whip.c | 6 +++--- >>>   1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/libavformat/whip.c b/libavformat/wh

Re: [FFmpeg-devel] [PATCH 05/18] avformat/whip: fix format string for printing size_t

2025-07-03 Thread Andreas Rheinhardt
Timo Rothenpieler: > --- > libavformat/whip.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavformat/whip.c b/libavformat/whip.c > index 7cd3f48ba9..71c667cd31 100644 > --- a/libavformat/whip.c > +++ b/libavformat/whip.c > @@ -926,7 +926,7 @@ static int parse_a

Re: [FFmpeg-devel] [PATCH 0/4] Check sample rate generically

2025-07-03 Thread Andreas Rheinhardt
ffmpegagent: > This is an alternative to > https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345575.html. > > Andreas Rheinhardt (4): > avcodec/avcodec: Check sample_rate generically > avcodec/wma,wmaprodec: Remove always-false checks > avcodec/wma: Remove redund

Re: [FFmpeg-devel] [PATCH] avcodec/dfpwmenc: Correctly pad input

2025-07-03 Thread Andreas Rheinhardt
Andreas Rheinhardt: > Patch attached. > > - Andreas > Will apply this patchset tonight unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To

Re: [FFmpeg-devel] [PATCH 00/48] H263DecContext

2025-07-03 Thread Andreas Rheinhardt
o the actual decoder contexts (no > get_bits.h inclusion in encoders any longer). Furthermore, MpegEncContext. > is put into the codec contexts and no longer separately allocated. > > Andreas Rheinhardt (48): > avcodec/ituh263dec: Use correct logcontext > avcodec/rl

Re: [FFmpeg-devel] [PATCH 1/8] tests/fate/screen: Add test for skipping cursor with FIC

2025-07-03 Thread Andreas Rheinhardt
Andreas Rheinhardt: > Patches attached. > > - Andreas > Will apply tonight unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visi

Re: [FFmpeg-devel] [PATCH] libavformat.v, libavutil.v: tighten export whitelist

2025-07-03 Thread Andreas Rheinhardt
Scott Theisen: > This matches how the other libraries define their exported symbols. > --- > libavformat/libavformat.v | 5 - > libavutil/libavutil.v | 4 +++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/libavformat/libavformat.v b/libavformat/libavformat.v > index

Re: [FFmpeg-devel] [PATCH] libavformat/usmdec: add support for HCA stream decryption

2025-06-25 Thread Andreas Rheinhardt
Pavel Roslyy: > --- > libavformat/usmdec.c | 53 +--- > 1 file changed, 50 insertions(+), 3 deletions(-) > > diff --git a/libavformat/usmdec.c b/libavformat/usmdec.c > index fd28e935ce..c5f2e208df 100644 > --- a/libavformat/usmdec.c > +++ b/libavformat/usmd

[FFmpeg-devel] [PATCH 48/48] avcodec/rv34: Fix spelling mistake

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/rv34.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index bd8800ee5d..f78b91e7df 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1800,7 +1800,7

[FFmpeg-devel] [PATCH 47/48] avcodec/rv34: Don't report progress unnecessarily

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt ff_mpv_frame_end() already does it. Signed-off-by: Andreas Rheinhardt --- libavcodec/rv34.c | 4 1 file changed, 4 deletions(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 4feab95eb5..bd8800ee5d 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c

[FFmpeg-devel] [PATCH 46/48] avcodec/mpegvideo: Move loop_filter to {H263Dec, MPVEnc, VC1}Context

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/dxva2_vc1.c | 4 ++-- libavcodec/h261enc.c | 4 ++-- libavcodec/h263dec.c | 4 ++-- libavcodec/h263dec.h | 1 + libavcodec/intelh263dec.c | 2 +- libavcodec/ituh263dec.c| 8

[FFmpeg-devel] [PATCH 45/48] avcodec/mpegvideo: Move partitioned_frame to {H263Dec, MPVEnc}Context

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 16 libavcodec/h263dec.h | 1 + libavcodec/mpeg4videodec.c | 10 +- libavcodec/mpeg4videoenc.c | 2 +- libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 10

[FFmpeg-devel] [PATCH 44/48] avcodec/mpeg_er: Allow to skip setting partitioned_frame, p[pb]_time

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Instead of setting these unconditionally (they are always zero for H.261, MPEG-1/2, RV30/40, VC-1), add a variant of ff_mpeg_er_frame_start() that sets them and remove setting them from ff_mpeg_er_frame_start(). Also pass these values via parameters instead of reading

[FFmpeg-devel] [PATCH 43/48] avcodec/mpegvideo: Move fields to {H263Dec, MPVEnc}Context when possible

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/flvdec.c| 6 +-- libavcodec/flvenc.c| 2 +- libavcodec/h261enc.c | 2 +- libavcodec/h263dec.c | 14 +++ libavcodec/h263dec.h | 14 +++ libavcodec/intelh263dec.c | 4

[FFmpeg-devel] [PATCH 42/48] avcodec/flvdec: Binarize h263_flv

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It used to be a tri-state encoding both whether to use FLV picture headers and whether to use the FLV way of encoding escape values, but the former is now unnecessary due to the switch to a function pointer for reading the header. So binarize h263_flv. Signed-off-by

[FFmpeg-devel] [PATCH 41/48] avcodec/ituh263enc: Inline value of h263_flv

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It is always two when we encode FLV1. Signed-off-by: Andreas Rheinhardt --- libavcodec/flvenc.c| 2 +- libavcodec/ituh263enc.c| 12 libavcodec/mpegvideo_enc.c | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libavcodec

[FFmpeg-devel] [PATCH 40/48] avcodec/h263dec: Use function ptr for decode_picture_header

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 27 ++- libavcodec/h263dec.h | 8 +++- libavcodec/mpeg4videodec.c | 3 ++- libavcodec/mpeg4videodec.h | 1 - libavcodec/msmpeg4dec.c| 8 +--- libavcodec

[FFmpeg-devel] [PATCH 39/48] avcodec/msmpeg4dec: Move ff_msmpeg4_decode_init() down

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Will avoid a forward declaration lateron. Signed-off-by: Andreas Rheinhardt --- libavcodec/msmpeg4dec.c | 79 + 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c

[FFmpeg-devel] [PATCH 38/48] avcodec/mpegvideo: Move SLICE_* defs to h263dec.h, h261dec.c

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 4 libavcodec/h263dec.h | 4 libavcodec/mpegvideo.h | 5 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index e47bc00a71

[FFmpeg-devel] [PATCH 37/48] avcodec/mpegvideo: Move mb_skip_run to {RV34Dec, MPVEnc}Context

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/h261enc.c | 12 ++-- libavcodec/mpeg12enc.c | 8 libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 11 ++- libavcodec/mpegvideoenc.h | 2 ++ libavcodec/rv34.c

[FFmpeg-devel] [PATCH 36/48] avcodec/mpeg12dec: Put mb_skip_run on the stack

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index db6f9d66a5..998f6aa2e5 100644 --- a/libavcodec/mpeg12dec.c

[FFmpeg-devel] [PATCH 35/48] avcodec/mpegvideo: Move mb_num_left to {H263, RV34}DecContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.h | 2 ++ libavcodec/ituh263dec.c| 2 +- libavcodec/mpeg4videodec.c | 4 ++-- libavcodec/mpegvideo.h | 1 - libavcodec/rv10.c | 2 +- libavcodec/rv34.c | 16

[FFmpeg-devel] [PATCH 34/48] avcodec/mpegvideo: Move fields only used by H.263 decoders to H263DecCtx

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/flvdec.c| 4 ++-- libavcodec/h263dec.c | 28 +- libavcodec/h263dec.h | 20 +++ libavcodec/intelh263dec.c | 8 libavcodec/ituh263dec.c| 40

[FFmpeg-devel] [PATCH 33/48] avcodec/mpeg12dec: Don't use MPVContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Instead add the necessary blocks directly into Mpeg12SliceContext. This allows to completely remove MPVContext.block. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 40 -- libavcodec/mpeg4videodec.c | 1

[FFmpeg-devel] [PATCH 32/48] avcodec/mpeg12dec: Move MpegEncContext.gb to Mpeg12SliceContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It was its last user. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 207 + libavcodec/mpegvideo.h | 4 - 2 files changed, 104 insertions(+), 107 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec

[FFmpeg-devel] [PATCH 31/48] avcodec/mpegvideo: Add missing headers

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt These files currently rely on implicit inclusions of avassert.h and/or mathops.h via get_bits.h. Signed-off-by: Andreas Rheinhardt --- libavcodec/error_resilience.c | 2 ++ libavcodec/me_cmp.c| 1 + libavcodec/mips/mpegvideo_msa.c

[FFmpeg-devel] [PATCH 30/48] avcodec/mpeg12dec: Add Mpeg12SliceContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This is in preparation for removing the GetBitContext from MPVContext. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 863 + libavcodec/mpegvideo.c | 2 +- libavcodec/mpegvideo.h | 1 + 3 files changed, 436

[FFmpeg-devel] [PATCH 29/48] avcodec/h263dec: Stop using MpegEncContext.gb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Add a GetBitContext to H263DecContext instead. This is in preparation for removing MpegEncContext.gb. Also move last_resync_gb to H263DecContext. Signed-off-by: Andreas Rheinhardt --- libavcodec/flvdec.c| 24 +-- libavcodec/h263dec.c | 52

[FFmpeg-devel] [PATCH 28/48] avcodec/h263dec: Don't use MpegEncContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Instead add the necessary blocks directly to H263DecContext (only six are needed, not 12 as ff_mpv_common_init() currently allocates). Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 4 ++-- libavcodec/h263dec.h | 3 +++ libavcodec

[FFmpeg-devel] [PATCH 27/48] avcodec/h263dec: Remove redundant block parameter from decode_mb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt With the exception of mpeg4_decode_studio_mb(), all decode_mb functions implicitly presumed that the block provided as argument coincides with MpegEncContext.block (they zeroed the latter and then used the former to decode the block); mpeg4_decode_studio_mb() meanwhile

[FFmpeg-devel] [PATCH 23/48] avcodec/mpeg4videodec: Avoid unnecessary indirections

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This basically reverts d4967c04e040b3b2f937cad88599af825147ec94. Said commit was based on the false premise that it would be an aliasing violation to upcast a pointer to structure to a pointer to a bigger structure containing the original structure as its first element

[FFmpeg-devel] [PATCH 25/48] avcodec/mpegvideo: Move dct_precision to Mpeg4DecContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg4videodec.c | 25 ++--- libavcodec/mpeg4videodec.h | 1 + libavcodec/mpegvideo.h | 1 - 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b

[FFmpeg-devel] [PATCH 24/48] avcodec/{h263, mpeg4video}dec: Pass MPVContext*, not Mpeg4DecContext*

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt The code in h263dec.c is not supposed to know that the MPEG-4 decoder uses an Mpeg4DecContext as private context at all (said context is only exposed in a header so that hardware accelerations can access it and for the parser to use). Passing an MPVContext* directly also

[FFmpeg-devel] [PATCH 22/48] avcodec/mpegvideo: Move unrestricted_mv to MotionEstContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/motion_est.c| 4 ++-- libavcodec/motion_est.h| 1 + libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 18 +- libavcodec/rv20enc.c | 2 +- libavcodec/snowenc.c | 2

[FFmpeg-devel] [PATCH 21/48] avcodec/mpegvideo: Move flipflop_rounding to {MSMPEG4Dec, MPVEnc}Context

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Forgotten in 9964212545554d9ae1afaabd23a7f9a361997d01. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.h | 1 - libavcodec/mpegvideo_enc.c | 14 +++--- libavcodec/mpegvideoenc.h | 1 + libavcodec/msmpeg4dec.c| 8 libavcodec

[FFmpeg-devel] [PATCH 20/48] avcodec/mpeg12dec: Deduplicate variables

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This situation was created in merge commit 71d008ebe4f96974433eecfd3575bc82eb4b06a8. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c

[FFmpeg-devel] [PATCH 19/48] avcodec/vc1: Don't use MpegEncContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Instead add the necessary blocks directly to VC1Context (only six are needed, not 12 as ff_mpv_common_init() currently allocates). Signed-off-by: Andreas Rheinhardt --- libavcodec/vc1.h | 4 libavcodec/vc1_block.c | 28

[FFmpeg-devel] [PATCH 18/48] avcodec/vc1: Stop using MpegEncContext.gb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Add a GetBitContext to VC1Context instead. This is in preparation for removing MpegEncContext.gb. Signed-off-by: Andreas Rheinhardt --- libavcodec/dxva2_vc1.c | 2 +- libavcodec/mss2.c | 4 +- libavcodec/vaapi_vc1.c | 2 +- libavcodec/vc1.c | 14

[FFmpeg-devel] [PATCH 17/48] avcodec/intrax8: Don't pretend to need more than one int16_t[64]

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Intrax8 needs only a single block. Signed-off-by: Andreas Rheinhardt --- libavcodec/intrax8.c | 16 libavcodec/intrax8.h | 4 ++-- libavcodec/vc1dec.c | 2 +- libavcodec/wmv2dec.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff

[FFmpeg-devel] [PATCH 16/48] avcodec/rv34: Don't use MpegEncContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt These decoders only need a single 4x4 block; put it in RV34DecContext. This is in preparation for removing MpegEncContext.block. Signed-off-by: Andreas Rheinhardt --- libavcodec/rv34.c | 7 +++ libavcodec/rv34.h | 1 + 2 files changed, 4 insertions(+), 4 deletions

[FFmpeg-devel] [PATCH 15/48] avcodec/rv34: Don't use MpegEncContext.gb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This is in preparation for removing MpegEncContext.gb. Signed-off-by: Andreas Rheinhardt --- libavcodec/rv30.c | 2 +- libavcodec/rv34.c | 28 ++-- libavcodec/rv34.h | 2 ++ libavcodec/rv40.c | 2 +- 4 files changed, 18 insertions(+), 16

[FFmpeg-devel] [PATCH 14/48] avcodec/mpeg12dec: Remove unused function parameter

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index ec8b213206..a056dd87cc 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec

[FFmpeg-devel] [PATCH 13/48] avcodec/mpeg12dec: Put GetBitContext on the stack where advantageous

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This is in preparation for no longer using MpegEncContext.gb. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 192 ++--- 1 file changed, 102 insertions(+), 90 deletions(-) diff --git a/libavcodec/mpeg12dec.c b

[FFmpeg-devel] [PATCH 12/48] avcodec/h261dec: Don't use MpegEncContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Instead put it into H261DecContext. This is in preparation for removing MpegEncContext.block. Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec

[FFmpeg-devel] [PATCH 11/48] avcodec/h261dec: Stop using MpegEncContext.gb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This is in preparation for removing said field from MpegEncContext. Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 80 +++- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/libavcodec/h261dec.c b

[FFmpeg-devel] [PATCH 10/48] avcodec/mpegvideodec: Remove size expectation from ff_mpv_reconstruct_mb

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt In the common case of decoding 420 content, only six blocks are used and it makes perfect sense for the caller to only have that many. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 2 +- libavcodec/mpegvideodec.h | 2 +- 2 files changed, 2

[FFmpeg-devel] [PATCH 09/48] avcodec/mpeg_er: Don't use MpegEncContext.block

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt It is unused (because unquantizing/the idct has been disabled) apart from FF_DEBUG_DCT_COEFF debug code which makes no sense when this function is called via error resilience. So pass a NULL as block when calling ff_mpv_reconstruct_mb() from mpeg_er_decode_mb() and

[FFmpeg-devel] [PATCH 08/48] avcodec/mpegvideo_dec: Reindent after the previous commit

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Also use dedicated variables for the accesses. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index

[FFmpeg-devel] [PATCH 07/48] avcodec/mpegvideo_dec: Factor debugging dct coefficients out

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This allows to hint to the compiler that the branch is likely not taken by marking the factored out function as av_cold. It is also in preparation for further commits. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo_dec.c | 26 +++--- 1

[FFmpeg-devel] [PATCH 06/48] avcodec/mpegvideo: Add MPVContext typedef

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt MpegEncContext is also used for decoding, so it is a misnomer. This commit therefore adds MPVContext as typedef for it in order to gradually switch the code to the new name (in line with MPVEncContext). Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegvideo.h | 1

[FFmpeg-devel] [PATCH 05/48] avcodec/mpegvideoenc: Allocate blocks as part of MPVEncContext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This avoids mpegvideo.c having to deal with the fact that the encoders use two sets of blocks and is in preparation for not allocating blocks at all. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263enc.h | 2 +- libavcodec/mpeg4videodec.c | 1

[FFmpeg-devel] [PATCH 04/48] avcodec/ituh263dec: Only initialize ff_h263_rl_inter when needed

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt The H.263 decoder itself does not need max_run/max_level of this RLTable, only the MPEG-4 decoder does. Signed-off-by: Andreas Rheinhardt --- libavcodec/ituh263dec.c| 1 - libavcodec/mpeg4videodec.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git

[FFmpeg-devel] [PATCH 03/48] avcodec/ituh263enc: Simplify creating LUT

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Only very few combinations (2x102) of 16384 correspond to valid codes; so just initialize all codes via memset and then set the few valid codes explicitly instead of initializing everything in the same way. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263data.h

[FFmpeg-devel] [PATCH 02/48] avcodec/rl: Avoid branch in index lookup

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt This uses the same logic as the MPEG-1/2 and SpeedHQ encoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/rl.h | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/rl.h b/libavcodec/rl.h index c45d8659d1..2588de2440 100644 --- a

[FFmpeg-devel] [PATCH 01/48] avcodec/ituh263dec: Use correct logcontext

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/ituh263dec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index f1f96010b2..95cd8f0b13 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec

Re: [FFmpeg-devel] [PATCH 1/4] avformat/iamf_parse: Check extradata size

2025-06-23 Thread Andreas Rheinhardt
James Almer: > On 6/23/2025 9:44 AM, Michael Niedermayer wrote: >> On Fri, Jun 20, 2025 at 12:28:13AM +0200, Andreas Rheinhardt wrote: >>> Michael Niedermayer: >>>> Fixes: Assertion n>=0 && n<=32 failed at ./libavcodec/get_bits.h:406 >>

[FFmpeg-devel] [PATCH] avcodec/g728dec: Remove AVCodec.sample_fmts

2025-06-23 Thread Andreas Rheinhardt
Patch attached. - Andreas From e2b8892a583a09ca4aa607af8813b4947c2e6fc1 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 23 Jun 2025 12:41:36 +0200 Subject: [PATCH] avcodec/g728dec: Remove AVCodec.sample_fmts It is unnecessary for decoders (they just set AVCodecContext.sample_fmt

[FFmpeg-devel] [PATCH 4/4] avcodec/wmaprodec: Avoid branch for setting block_align

2025-06-23 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Signed-off-by: Andreas Rheinhardt --- libavcodec/wmaprodec.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 7f3dc7fd8b..d87ed0433e 100644 --- a/libavcodec/wmaprodec.c +++ b

[FFmpeg-devel] [PATCH 3/4] avcodec/wma: Remove redundant nb_channels check

2025-06-22 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Already checked generically as none of the codecs here have the AV_CODEC_CAP_CHANNEL_CONF set. Signed-off-by: Andreas Rheinhardt --- libavcodec/wma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wma.c b/libavcodec/wma.c index

[FFmpeg-devel] [PATCH 2/4] avcodec/wma, wmaprodec: Remove always-false checks

2025-06-22 Thread Andreas Rheinhardt
From: Andreas Rheinhardt None of the codecs used here has the AV_CODEC_CAP_CHANNEL_CONF cap set, so the sample rate is checked generically. Signed-off-by: Andreas Rheinhardt --- libavcodec/wma.c | 2 +- libavcodec/wmaprodec.c | 5 - 2 files changed, 1 insertion(+), 6 deletions

[FFmpeg-devel] [PATCH 1/4] avcodec/avcodec: Check sample_rate generically

2025-06-22 Thread Andreas Rheinhardt
From: Andreas Rheinhardt Check that all audio codecs except decoders with the AV_CODEC_CAP_CHANNEL_CONF flag have a positive sample rate set. Fixes: AVERROR_BUG return Fixes: 413997604/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5188382613635072 Found-by: continuous fuzzing

[FFmpeg-devel] [PATCH 1/8] tests/fate/screen: Add test for skipping cursor with FIC

2025-06-22 Thread Andreas Rheinhardt
Patches attached. - Andreas From b3b26d0b46a44adc0d4ccdfcffb7b808fbf056df Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 23 Jun 2025 03:37:08 +0200 Subject: [PATCH 1/8] tests/fate/screen: Add test for skipping cursor with FIC Signed-off-by: Andreas Rheinhardt --- tests/fate

[FFmpeg-devel] [PATCH] avcodec/ffv1enc: Use dummies to avoid UB pointer arithmetic

2025-06-22 Thread Andreas Rheinhardt
Patch attached. - Andreas From 74609d43bdce4556651e033ce4ee8fcb022d3c95 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 22 Jun 2025 23:25:34 +0200 Subject: [PATCH] avcodec/ffv1enc: Use dummies to avoid UB pointer arithmetic Fixes the following FATE-tests when run under Clang-UBSan

[FFmpeg-devel] [PATCH 1/2] swresample/rematrix: Use correct function pointer types for calls

2025-06-22 Thread Andreas Rheinhardt
Patches attached. - Andreas From 520002b8a95d06baaf2a10c660e21bf84d036787 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 23 Jun 2025 02:02:54 +0200 Subject: [PATCH 1/2] swresample/rematrix: Use correct function pointer types for calls Calling a function via a different function

[FFmpeg-devel] [PATCH 1/3] avcodec/indeo3: Fix UB pointer arithmetic

2025-06-22 Thread Andreas Rheinhardt
Patches attached. - Andreas From b0c865afeb02e5bce6cb43e5c3ec660e2833d25c Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 22 Jun 2025 22:36:00 +0200 Subject: [PATCH 1/3] avcodec/indeo3: Fix UB pointer arithmetic Fixes the following error when running with Clang-UBSan: src

  1   2   3   4   5   6   7   8   9   10   >