1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

123848 Commits

Author SHA1 Message Date
Marvin Scholz
92611900bb avcodec: nellymoser: reject invalid sample rate
Nellymoser expects the caller to set the samplerate, as it
doesn't read it from the bitstream. However the generic check
for this is bypassed as it has the AV_CODEC_CAP_CHANNEL_CONF
capability because it does set the channel configuration,
however that cap also bypasses the generic samplerate check.

This is mostly harmless as nellymoser doesn't care about the
samplerate, but since f566032bfd it would cause an AVERROR_BUG
to be returned to the caller, so better reject it outright in
the decoder.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit 23918b3200)
2026-10-22 03:15:51 +00:00
Marvin Scholz
5c4f5744cd avcodec/aac: fix null dereference in che_configure
During USAC decoding (ff_aac_usac_decode_frame), configuration elements
can be mapped and instantiated via che_configure(). For newly allocated
ChannelElement structs, che_configure calls sbr_ctx_alloc_init() which
dynamically allocates ac->che[type][id]. However, che_configure did not
subsequently map the output pointer of the nested SingleChannelElement
elements back to their statically-sized internal ret_buf arrays, causing
a null pointer dereference during IMDCT windowing.

The fix explicitly initializes these pointers following allocation.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit 8319541103)
2026-10-21 19:56:50 +00:00
Marvin Scholz
c799e824fd avcodec/mvcdec: zero-initialize color array
Fixes MSAN use-of-uninitialized-value.

Signed-off-by: Marvin Scholz <epirat07@gmail.com>
(cherry picked from commit 3a5eb948e7)
2026-10-21 19:41:44 +00:00
Damiano Galassi
e25fefc85e avformat/movenc: fix mov_create_dvd_sub_decoder_specific_info
It has been broken since 3064487.

(cherry picked from commit 1aefacfda4)
Signed-off-by: Marvin Scholz <epirat07@gmail.com>
2026-10-21 19:32:37 +00:00
Michael Niedermayer
c8de997cb1 avcodec/aac/aacdec_usac: check the element list against the channel configuration
Fixes: NULL pointer dereference
Fixes: bMZdbdGgJICu
Fixes: aac_usac_null.mp4
Regression since: eee5fa0808
Found-by: Glops Elemiu

(cherry picked from commit 23316a12ac)

Assisted-by: Fairy
2026-10-21 07:56:58 +00:00
Vincent Herbst
2847803bfd avfilter/vf_yadif_videotoolbox: fix over-release of autoreleased Metal objects
call_kernel() obtains the command buffer and compute encoder from
property getters (mtlQueue.commandBuffer, buffer.computeCommandEncoder),
which return autoreleased references under the non-ARC build, and then
releases them via ff_objc_release(). That is an over-release: when the
enclosing autorelease pool is drained, the objects are released a second
time and the process crashes with EXC_BAD_ACCESS in objc_release.

On current macOS this is reproducible with the ffmpeg CLI itself. The
filter thread's thread-local autorelease pool is popped during pthread
TSD cleanup at thread exit, so any run that used yadif_videotoolbox
crashes when the filter thread terminates:

  ffmpeg -init_hw_device videotoolbox=vt -filter_hw_device vt \
    -f lavfi -i testsrc2=size=640x480:rate=30 \
    -vf setfield=tff,format=nv12,hwupload,yadif_videotoolbox,\
  hwdownload,format=nv12 -frames:v 20 -f null -

  Thread 11 Crashed:: vf#0:0
  0 libobjc.A.dylib  objc_release + 16
  1 libobjc.A.dylib  AutoreleasePoolPage::releaseUntil(objc_object**) + 204
  2 libobjc.A.dylib  objc_autoreleasePoolPop + 244
  3 libobjc.A.dylib  objc_tls_direct_base<...>::dtor_(void*) + 156
  4 libsystem_pthread.dylib  _pthread_tsd_cleanup + 620
  5 libsystem_pthread.dylib  _pthread_exit + 84

Host applications hit the same crash earlier, for example when a
dispatch queue drains its last-resort pool after a work item that ran
the filter.

Wrap the kernel invocation in @autoreleasepool and drop the manual
releases, making the pool pop the single balanced release and draining
the Metal transients once per frame. The ff_objc_release() calls on the
s->mtl* members in do_uninit() stay: those hold owned references
obtained from new* methods.

(cherry picked from commit 7f2e5cdd7c)
2026-10-20 02:01:21 +00:00
James Almer
46d899d7a0 avformat/mov: check ff_mov_read_chnl return value
Fixes use of uninitialized value.
Fixes issue #24960.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-11 11:11:53 -03:00
Timo Rothenpieler
c389840894 avformat/imfdec: don't busy-loop if non-Asset in Asset-list
(cherry picked from commit ef305e32e8)
2026-10-09 23:25:18 +00:00
Diego de Souza
e0a878dd70 avcodec/dxva2: fix frame->buf[] data race with frame threading
ff_dxva2_common_end_frame() adds a reference to the decoder to
frame->buf[], so that the decoder outlives the frames decoded with it.
It is called from the hwaccel end_frame() callback, which with frame
threading may run after ff_thread_finish_setup(). From that point on,
other threads may copy the frame: the H.264 decoder keeps a separate
AVFrame per picture in each thread and synchronizes them in
update_thread_context() with av_frame_replace(), which reads
frame->buf[] while the decoding thread may be writing to it. As noted
in fa77cb258b ("avcodec/h264dec: Fix data race when updating
decode_error_flags"), a decoding thread must not modify any field that
av_frame_ref() copies after ff_thread_finish_setup().

This has been observed as an intermittent access violation in
av_buffer_replace() when decoding H.264 with D3D11VA and frame
threading on Windows on Arm: the copying thread read a non-NULL
frame->buf[1] entry, but saw the fields of the AVBufferRef it points
to as zero, and dereferenced the NULL buffer pointer when incrementing
the reference count.

Store the decoder reference in FrameDecodeData.hwaccel_priv instead,
as nvdec does for its per-frame state. The decode data is attached to
frame->private_ref when the buffer is allocated, before
ff_thread_finish_setup(), and all references to the frame share it, so
update_thread_context() only takes a new reference to it. The decoder
reference is added to frame->buf[] by hwaccel_priv_post_process(),
which runs in the caller's thread when the frame is returned, so
returned frames keep the decoder alive. Since the decode data
is shared, the second field of a field pair no longer adds a second
decoder reference to the frame.

Signed-off-by: Diego de Souza <ddesouza@nvidia.com>
(cherry picked from commit 538d10d187)
2026-10-08 21:34:32 +02:00
James Almer
e5f25f8e73 avcodec/decode: add a hwaccel specific post_process callback to FrameDecodeData
Leave the existing one for non decoder-specific, post processing usage.
With this, scenarios like nvdec decoding can work algonside lcevc enhancement application.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-08 21:34:32 +02:00
Timo Rothenpieler
330caae0c1 avfilter/vf_scale_cuda: consider chroma subsampling for scaling decisions
(cherry picked from commit a621ef4291)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
de8f9b5f27 avfilter/vf_scale_cuda: always have valid passes setup
(cherry picked from commit 4566eee588)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
39ee21dc9a avfilter/vf_scale_cuda: extract pass determination into its own function
(cherry picked from commit dda8b8253c)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
c11c663ca5 avfilter/vf_scale_cuda: skip allocating intermediate texture if not needed
(cherry picked from commit 3d7ea1dac4)

Assisted-by: Fairy
2026-09-30 18:30:01 +00:00
Timo Rothenpieler
e657988499 avfilter/vf_scale_cuda: don't try to execute disabled filter passes
(cherry picked from commit 50a9e34e1b)

Assisted-by: Fairy
2026-09-30 18:30:00 +00:00
Timo Rothenpieler
29e619e767 avcodec/aacsbr_template: don't leak on ff_aac_sbr_ctx_alloc_init failure
Fixes: #YWH-PGM40646-23
(cherry picked from commit e383b7d532)
2026-09-29 20:29:30 +00:00
Timo Rothenpieler
2223115a5a avfilter/vf_convolution: don't assume frame is multiple of 16 pixels wide
Limit the 8-bit column filter to the pixels remaining in the current slice. Pass slice_end - y at all three call sites so both the 8-bit and high-bit-depth column filters receive the correct remaining width. This handles partial 16-pixel blocks at frame and thread-slice boundaries. The non-column callbacks do not use this argument.

Fixes: #YWH-PGM40646-36
(cherry picked from commit 8b9e02cc17)
2026-09-29 20:08:24 +00:00
Timo Rothenpieler
eb4d7e3c30 avformat/mux: don't let positive write_trailer ret shadow pb failure
(cherry picked from commit 1de217ad4b)
2026-09-29 19:26:10 +00:00
nyanmisaka
ff48edd8b2 hwcontext_vulkan: fix double free when vulkan_map_to_drm fails
The multiplanar image with storage_bit enabled fails to be exported
to DMA-BUF on the QCOM turnip driver, thus triggering this double-free issue.

```
[Parsed_hwmap_2 @ 0xffff5c002a70] Configure hwmap vulkan -> drm_prime.
[hwmap @ 0xffff5c001180] Filter input: vulkan, 1920x1080 (0).
[AVHWFramesContext @ 0xffff5c004e00] Unable to export the image as a FD!
free(): double free detected in tcache 2
Aborted
```

Additionally, add back an av_unused attribute. Otherwise, the compiler
will complain about unused variables when CUDA is not enabled.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
(cherry picked from commit ab7b6ef0a2)
Assisted-by: Fairy
2026-09-27 22:53:24 +00:00
Tymur Boiko
fc94e5adbc vulkan: fix -Wdiscarded-qualifiers warning and misleading DRM modifier log
ff_vk_find_struct returns const void *, so storing it in const void *drm_create_pnext
fixes the initialization warning but then dpb_hwfc->create_pnext = drm_create_pnext
assigns const void * to void *, triggering the same warning at that line. The right
fix is a (void *) cast at the call site, same as done for buf_pnext.

Also restrict the GetPhysicalDeviceImageFormatProperties2 verbose log in
try_export_flags to the DRM modifier path only: when has_mods is false the log
always printed mod[0]=0x0, which is misleading since no DRM modifier is involved.

Signed-off-by: Tymur Boiko <tboiko@nvidia.com>
(cherry picked from commit f7ca6f7481)
Assisted-by: Fairy
2026-09-27 22:53:24 +00:00
Tymur Boiko
6849ebfe98 vulkan: fix DRM map, decode barriers, and video frame setup for modifier output
When mapping Vulkan Video frames to DMA-BUF, synchronize using an exportable
binary semaphore and sync_fd where supported. Submit a lightweight exec that
waits on each plane's timeline semaphore at the current value, signals a
SYNC_FD-exportable binary semaphore, then export with vkGetSemaphoreFdKHR.
Store that binary semaphore in AVVkFrameInternal and reuse it across maps
instead of creating and destroying each time: for
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, copy transference means a
successful vkGetSemaphoreFdKHR unsignals the semaphore like a wait, so it can
be signaled again on the next map submit. If export is unavailable, fall back
to vkWaitSemaphores.

Moved drm_sync_sem destroy to vulkan_free_internal

Export dma-buf fds with GetMemoryFdKHR for each populated f->mem[i], iterating
up to the sw_format plane count instead of stopping at the image count, so
multi-memory bindings are not skipped. Describe DRM layers using
max(sw planes, image count) and query subresource layout with the correct
aspect and image index when one VkImage backs multiple planes. Reference the
source hw_frames_ctx on the mapped frame and close dma-buf fds on failure paths.

For DMA-BUF-capable pools, honor VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT
from format export queries when binding memory. With DRM modifiers and a
video profile in create_pnext, preserve caller usage and image flags instead of
overwriting them from generic supported_usage probing; use the modifier list
create info when probing export flags for modifier tiling.

Include VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR from the output frames
context's usage together with DST (fixes
VUID-VkVideoBeginCodingInfoKHR-slotIndex-07245) instead of adding DPB usage
only when !is_current.

In ff_vk_decode_add_slice, pass VkVideoProfileListInfoKHR (from the output
frames context's create_pnext) as the pNext argument to
ff_vk_get_pooled_buffer instead of the full create_pnext chain. In
ff_vk_frame_params, set tiling to OPTIMAL only when it is not already
DRM_FORMAT_MODIFIER_EXT. In ff_vk_decode_init, when the output pool's
create_pnext includes VkImageDrmFormatModifierListCreateInfoEXT, initialize the
DPB pool with that modifier-list pNext and DRM_FORMAT_MODIFIER_EXT tiling;
otherwise use VkVideoProfileListInfoKHR and OPTIMAL as before. When
VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR is unset, the output
and DPB pools cannot use different layouts or tiling, so the DPB pool must
match the output pool.

Also fix av_hwframe_map ioctl sync_fd export, multi-planar semaphore handling,
and related failure-path cleanup.

Signed-off-by: Tymur Boiko <tboiko@nvidia.com>
(cherry picked from commit 25e187f849)
Assisted-by: Fairy
2026-09-27 22:53:24 +00:00
Sergei Iashin
6c5a6f053c libavformat/dashenc.c: check if packets were muxed before calculating average bitrate
Prevents SIGFPE.
Fixes issue #24738.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit d62aef2e50)
2026-09-27 11:51:00 -03:00
Timo Rothenpieler
45e8e0a3ff avformat/mov: don't leak on realloc failure
Fixes: #YWH-PGM40646-48
(cherry picked from commit d975849594)
2026-09-26 16:05:05 +00:00
Werner Robitza
0880196367 avcodec/liboapvenc: fix build with openapv >= 1.1
openapv 1.1 changed oapvm_create() to take a descriptor argument.
This was first raised here:
https://github.com/homebrew-ffmpeg/homebrew-ffmpeg/issues/235

(cherry picked from commit c54710db21)
2026-09-26 14:46:51 +00:00
Timo Rothenpieler
1041abdc96 avformat/tls_gnutls: actually send client cert if one is provided
Without setting this flag, apparently gnutls will only send the client
certificate according some logic based on what it thinks the server
accepts.
This is not the case a lot of times.
Just force it to send the client cert the user supplied, if one was
supplied, no matter what.

Fixes #22707

(cherry picked from commit 5c35d0b880)
n8.1.3
2026-09-20 23:13:50 +00:00
James Almer
b2f422d306 avcodec/libfdk-aacdec: clear and reset some fields when flushing
The decoder can't know where a seek landed, so the "delay_samples" way to
discard the decoder delay in the first frame is not truly viable, so it needs
to be removed.
Add a call to aacDecoder_DecodeFrame() with the AACDEC_CLRHIST flag set, as the
call to aacDecoder_SetParam() with the AAC_TPDEC_CLEAR_BUFFER setting was
seemingly not enough to truly flush all the fdkaac internal buffers.

Should fix issue #24527.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit b894a6f7c1)
2026-09-19 22:26:38 -03:00
James Almer
ec8ec90d51 avcodec/libfdk-aacdec: properly handle decoder delay
Shift timestamps when available, and take into account the caller requested
samples to be discarded alongside the decoder delay.

Should fix issue #24526.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit c8595be8e6)
2026-09-19 22:26:38 -03:00
James Almer
07cf17663e Changelog: fix typos in a couple entries
Makes the Lint CI job happy.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-09-19 21:35:05 -03:00
James Almer
a8e6b8cba7 avcodec/libfdk-aacdec: fix the check for downmix layout order
The code reads a mask afer this check, meaning it expects NATIVE order, not
others.

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 7755d264bd)
2026-09-19 21:08:26 -03:00
Michael Niedermayer
a4a6cb1e4a Bump for 8.1.3 2026-09-19 18:28:12 +02:00
Michael Niedermayer
ad096ddd65 cosmetics: Changelog: drop the commit hashes from the 8.1.3 entries
The 8.1.3 section listed every entry with its commit hash and one
entry also named a private branch. The entries now use the same
format as the 8.1.2 section, only the pull request references stay.
2026-09-19 18:28:05 +02:00
Michael Niedermayer
b2957392d5 Changelog: update for the fixes since 8.1.3 2026-09-19 18:05:15 +02:00
Kacper Michajłow
4bca65da83 Revert "lavfi/bwdif: fix heap-buffer-overflow with small height videos"
This reverts commit 5bc4a9898c.

The heap-buffer-overflow was a symptom of the >8 bit boundary
conditions bug fixed in the previous commit. This workaround is no
longer needed.

This restores spatial-only interpolation of the whole frame for the
first and last fields, instead of running the temporal edge filter
against cloned reference frames on the outermost lines. Because of that
first frame references are updated to pre-fix values.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 3cd408c2a6e5a7de8b6d641dedd12d523b94014c)
2026-09-19 17:01:18 +02:00
Kacper Michajłow
11076bf269 avfilter/vf_bwdif: fix line boundary checks for >8 bits content
The mrefs/prefs boundary conditions scaled the y limits by the number of
bytes per sample, even though the ref offsets are already expressed in
elements. For content deeper than 8 bits this clamped perfectly valid
in-bounds line taps.

Found by validating the libplacebo GPU port against this filter, which
matches exactly on 16-bit content everywhere except these lines.

This changes the output for >8 bit content on the affected lines.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit 7d96c87a7382fed8d571748d6ed5c1869c192c31)
2026-09-19 17:00:37 +02:00
Jack Lau
6442b04b0f avformat/hlsenc: fix compile error when mp4 is disabled
Regression since dc4c798970

Handle the case where mp4 is disabled since mp4 as
an optional dependency of hls_muxer.

Signed-off-by: Jack Lau <jacklau1222gm@gmail.com>
(cherry picked from commit 0510aff11b)
2026-09-19 17:00:37 +02:00
Ramiro Polla
b46c21cf03 swscale/unscaled: fix rgbToRgbWrapper for non-native-endian formats
The fix from 5fa2a65c11 introduced a regression for non-native-endian
formats (such as rgb565be on a little-endian system).

Reproducible with:
$ ./libswscale/tests/swscale -unscaled 1 -src rgb565be -dst rgb24

Also:
$ ./ffmpeg_g -i /opt/samples/jpegls/128.jls -vf "scale=size=512x512,format=rgb24,scale=flags=neighbor,format=rgb565be" -f rawvideo -vframes 1 -y rgb565be.raw
$ magick -size 512x512 -endian MSB RGB565:rgb565be.raw output.png
$ ./ffplay_g output.png

(note: don't use ffmpeg to convert from rgb565be.raw to output for the
test above since it will perform the same bug and cancel out the error)

(cherry picked from commit d0a84c660a)
2026-09-19 17:00:37 +02:00
Kacper Michajłow
51715a5344 avformat/hls: avoid casting callback functions type
Technically it's is UB to call function of different type.

Fixes:
src/libavformat/utils.c:531:9: runtime error: call to function handle_variant_args through pointer to incorrect function type 'void (*)(void *, const char *, int, char **, int *)'
src/libavformat/hls.c:379: note: handle_variant_args defined here

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit d768bd564e)
2026-09-19 17:00:29 +02:00
Michael Niedermayer
a1ced74e8d avcodec/vulkan/ffv1_dec_setup: act on the slice header rejection
(cherry picked from commit 533a3c254d)
2026-09-19 17:00:18 +02:00
Michael Niedermayer
b2c3ad438c avformat/hlsenc: reject out-of-range EXT-X-PROGRAM-DATE-TIME
Parse the timestamp with av_small_strptime() instead of sscanf(): it
range-checks each field (year 0-9999, month, day, hour, minute, second)
and limits the number of digits consumed, so an oversized field can no
longer overflow during parsing. The mktime() result is additionally
checked for EOVERFLOW.

Fixes: integer overflow

Found-by: Kery (Qi Kery <qikeyu2001@outlook.com>)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c82196b299)
2026-09-19 17:00:07 +02:00
Niklas Haas
4d58e9d8d4 avformat/http: only re-use old connection if valid
Otherwise, this might leak stale bytes that were already drained by the
HTTP soft-seek attempt.

Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 0d0f9a06ab)
2026-09-19 16:59:28 +02:00
Niklas Haas
cb4c0da19c avformat/http: properly re-set s->range_end before requests
Otherwise this could leak stale values from a previous response.

Sponsored-by: nxtedition AB
Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 8712114200)
2026-09-19 16:59:28 +02:00
Niklas Haas
9b88ec3141 avutil/rational: avoid signed integer overflow
Passing -INT_MIN to av_sub_q() overflows due to the negation. Writing out
the formula explicitly avoids this.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
(cherry picked from commit 6a853ce327)
2026-09-19 16:59:28 +02:00
Michael Niedermayer
6cebacddcc avformat/mpegts: Fix memleak of pes_filter.opaque
Fixes: 490257166/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-4815675538604032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c25673fe70)
2026-09-19 16:59:28 +02:00
Michael Niedermayer
3cd473d862 avcodec/leaddec: Check input data before allocating buffer
Fixes: Timeout
Fixes: 471636089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LEAD_fuzzer-6346348464242688

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit a780d46d3b)
2026-09-19 16:59:28 +02:00
Michael Niedermayer
959b0d1563 avcodec/jpeglsdec: bound cumulative decoded JPEG-LS height per packet
Fixes: Timeout
Fixes: 509211998/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THP_fuzzer-5098892286033920
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2ff28aca4b)
2026-09-19 16:59:28 +02:00
Michael Niedermayer
e1d767484b avcodec/cbs_h265: allocate VPS hrd_parameters dynamically
H265RawVPS embedded hrd_parameters as an inline array of
HEVC_MAX_LAYER_SETS (1024) H265RawHRDParameters, making the structure
roughly 7.9 MB. CBS allocates the whole content structure for every VPS
NAL unit before parsing it, so a packet consisting of many tiny VPS NALs
forces gigabytes of allocations and triggers an out-of-memory condition.

Allocate hrd_parameters separately, sized to vps_num_hrd_parameters,
backed by an AVBufferRef registered as a second internal reference
offset on the VPS unit type. This shrinks the resident structure to tens
of kilobytes and bounds the hrd_parameters allocation by the amount that
is actually parsed.

Fixes: 472754452/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-6379024978083840
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d2dd0a0a8f)
2026-09-19 16:59:28 +02:00
Andreas Rheinhardt
2bd4a58d87 avcodec/atsc_a53: Avoid GetBits API to parse A53 CC data
This fixes overreads with libdav1d, because it provides
non-padded data in violation to the requirements of
the GetBits API.

Furthermore, using the GetBits API here is wasteful,
as the offsets here are known and the actual data to be copied
is even byte-aligned, allowing to use memcpy.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit f2e5eff3ff)
2026-09-19 16:59:28 +02:00
Franciszek Kalinowski
32433b4b56 avcodec/pngdec: bound decompressed zTXt/iCCP size (decompression-bomb guard)
decode_zbuf() inflates zTXt (compressed text) and iCCP (ICC profile) chunk
payloads into an AVBPrint created with AV_BPRINT_SIZE_UNLIMITED and never
checks the decompressed size. A ~100 KB zTXt chunk of compressed zeros
expands to 100 MB; larger ratios or multiple chunks can exhaust memory.

Abort with AVERROR_INVALIDDATA once the decompressed output crosses a hard
cap (16 MiB).

Verified with a crafted PNG (1 KB compressed -> 100 MB decompressed): without
the patch the chunk fully decompresses, taking >100 MB; with the patch the
inflate loop aborts and the decoder logs "Compressed PNG chunk expands
beyond 16777216 bytes" / "Broken zTXt chunk" while the rest of the image
decodes normally.

Reported by Franciszek Kalinowski (isec.pl / striga.ai) and Bartosz Smigielski.

(cherry picked from commit 69bdb05f36)
2026-09-19 16:59:28 +02:00
Linke
678672a786 avformat/av1: fix uvlc loop past end of bitstream
When get_bits_left() returns a negative value (bitstream reader already past the end of the buffer), the while condition while (get_bits_left(gb)) evaluates to true since any non-zero int is truthy.

With the safe bitstream reader enabled, get_bits1() returns 0 past the buffer end, so the break never triggers and leading_zeros increments toward INT_MAX.

Change the condition to > 0, consistent with skip_1stop_8data_bits() which already uses <= 0 for the same pattern.

Signed-off-by: Linke <1102336121@qq.com>
(cherry picked from commit e44d76f61f)
2026-09-19 16:59:28 +02:00
James Almer
8f0166f5d1 tools/zmqsend: close the input FILE
Fixes CVE-2026-30998

Fixes: Resource leak
Found-by: Xinghang Lv
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 18b83f2d0a)
2026-09-19 16:59:28 +02:00