1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-28 15:19:38 +03:00
Commit Graph

28038 Commits

Author SHA1 Message Date
Michael Niedermayer
557481dea6 avformat/rdt: Check the size of the AAC data left in the packet
The check was suggested in the report.

Hardening for JRU5LF4QdVjc (AISLE-2026-0111-00165)
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
2026-10-20 21:30:18 +00:00
Michael Niedermayer
5af7de7e3d avformat/rtpdec_av1: Read the OBU header byte after the size checks
Moving the read after the checks was suggested in the report.

Hardening for R5y4vDJ078Lr (AISLE-2026-0111-00004)
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
2026-10-20 21:30:18 +00:00
Michael Niedermayer
47dd85608f avformat/tee: Do not receive from the filters of a slave that failed
The continue was suggested in the report.

Hardening for ZKrMQAvMQyye (AISLE-2026-0111-00318)
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
2026-10-20 21:30:18 +00:00
Michael Niedermayer
a77318037b avformat/rtpenc_h263_rfc2190: check the return of init_get_bits8()
Fixes: OEXYJTpBYJPS
Fixes: NULL pointer dereference
NULL pointer dereference Replicated through API with ASAN
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24916
2026-10-20 20:41:50 +00:00
Michael Niedermayer
5422569d6a avformat/aviobuf: retry the read after AVERROR(EAGAIN)
Fixes: 3Fn44aM2tqIx
Fixes: infinite loop
Infinite loop Replicated through UnModified FFmpeg with a nonblocking pipe and timeout
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24909
2026-10-20 20:41:50 +00:00
Michael Niedermayer
c46268660b avformat/assenc: do not read the event beyond the packet
Fixes: FJdNqUYeEkPS
Fixes: wrong event text
Fixes: out of array read
Wrong event text Replicated through UnModified FFmpeg with plain output diff
Out of array read Replicated through API with ASAN
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24659

Found-by: Marton Balint <cus@passwd.hu>
Suggested-by: Marton Balint <cus@passwd.hu>
2026-10-20 20:41:50 +00:00
zhang xingxing
97daefb4d6 avformat/tls_mbedtls: free the mbedtls contexts on every error path
This is not a security issue.

Not replicated, compile tested only (mbedtls 3.6.2).

Fixes: T7EtPuJBKWqg
Fixes: swarm-Memory-leak-early-return-skips-mbedtls-resource-cleanup-a1d295

Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-20 11:36:57 +00:00
Michael Niedermayer
0ff8cac632 avformat/md5proto: free the MD5 context when opening the output fails
This is not a security issue.

Fixes: ORPoDnVi3BLg
Fixes: swarm-MD5-context-leaked-when-output-URL-open-fails-e4415f

Found-by: zhang xingxing <2388969553@qq.com>

Memory leak Replicated through UnModified FFmpeg with LSAN

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-20 11:36:57 +00:00
Michael Niedermayer
d58b31a865 avformat/matroskaenc: describe timestamp jumps when starting a cluster
The existing warning does not distinguish a forward timestamp outside the
Block's signed 16-bit range from a late packet that forces a backward
Cluster timestamp jump. Include the direction, stream index, incoming
timestamp, current Cluster timestamp and signed difference in milliseconds.

This addresses the diagnostic part of issue #24379. It does not change
packet interleaving or turn the condition into a muxing error.

Assisted-by: Fairy
2026-10-20 11:34:03 +00:00
Michael Niedermayer
857ee5f9c5 avformat/hls: saturate the playlist timestamp offset arithmetic
Fixes: signed integer overflow
Fixes: 2PuIAHF3wU0b
Regression since: e27ad5760c
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24873
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-20 02:25:09 +00:00
Michael Niedermayer
3f322521c0 avformat/hls: saturate the timestamps of ID3 timestamped streams
Fixes: signed integer overflow
Fixes: CniIhjP8pfgr
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24873
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-20 02:25:09 +00:00
Michael Niedermayer
d00d31e9c9 avformat/mov: saturate the fragment timestamp arithmetic in mov_read_trun()
Fixes: signed integer overflow
Fixes: 5NVcwD9UoHmO
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24878
Signed integer overflow Replicated through UnModified FFmpeg with UBSAN
2026-10-20 02:25:09 +00:00
Michael Niedermayer
de6fb646f7 avformat/http: send cookies given without a Domain only to their host
Fixes: cookie disclosure to other hosts
Fixes: u2ys08MO8oEF
Cookie disclosure Replicated through UnModified FFmpeg

Found-by: Yazan Balawneh, Cystack.ps
2026-10-20 02:19:24 +00:00
Michael Niedermayer
b34b321b07 avformat/rtpenc: Fragment MPEG audio frames that do not fit with the payload header
Fixes: ffmpeg -f lavfi -i sine=d=0.5 -ar 48000 -c:a mp2 -b:a 128k -f rtp -packetsize 396 rtp://127.0.0.1:45111?pkt_size=396

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
14f4e547d6 avformat/rtpenc_jpeg: Check that the JPEG payload header fits in the packet
Fixes: heap-buffer-overflow
Fixes: negative-size-param
Fixes: infinite loop
Fixes: hnrHe6JoiDya

Out of array write, negative-size memcpy and endless loop Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717), the
JPEG case is mentioned in the discussion of the issue
2026-10-20 01:28:04 +00:00
Michael Niedermayer
0575266957 avformat/rtpenc: Reject packet sizes too small for one sample
Fixes: infinite loop
Fixes: bz6tTr9RAaZT
Fixes: ffmpeg -f lavfi -i sine=d=0.2 -c:a pcm_s16be -f rtp -packetsize 13 /dev/null
Fixes: ffmpeg -f lavfi -i sine=d=0.2 -ar 8000 -c:a g726 -b:a 24k -f rtp -packetsize 14 /dev/null

Endless loop Replicated through UnModified FFmpeg

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
c77edecb53 avformat/rtpenc: Reject packet sizes too small for one iLBC frame
Fixes: heap-buffer-overflow
Fixes: sbHrRrZhcbbZ

Out of array write Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
de46025a0c avformat/rtpenc: Reject packet sizes too small for the VC-2 payload header
Fixes: heap-buffer-overflow
Fixes: zZoxZuoiTRhn

Out of array write Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
11c22178bb avformat/rtpenc: Reject packet sizes too small for the AV1 payload headers
Fixes: heap-buffer-overflow
Fixes: FyS11JI5UXC7
Fixes: ffmpeg -i fate-suite/av1/film_grain.ivf -frames:v 2 -c copy -strict experimental -f rtp -packetsize 13 /dev/null

Out of array read Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
092c2d9b72 avformat/rtpenc: Reject packet sizes too small for the VP9 payload descriptor
Fixes: infinite loop
Fixes: 2bIuZUVk7KRO
Fixes: ffmpeg -f lavfi -i testsrc=duration=0.2:size=64x64:rate=5 -c:v libvpx-vp9 -strict experimental -f rtp -packetsize 13 /dev/null

Endless loop Replicated through UnModified FFmpeg

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
59af4fea04 avformat/rtpenc: Reject packet sizes too small for the H.263 payload header
Fixes: negative-size-param
Fixes: infinite loop
Fixes: gFLqHoPMr8J5
Fixes: ffmpeg -f lavfi -i testsrc=duration=0.2:size=176x144:rate=5 -c:v h263 -f rtp -packetsize 13 /dev/null
Fixes: ffmpeg -f lavfi -i testsrc=duration=0.2:size=176x144:rate=5 -c:v h263 -rtpflags rfc2190 -f rtp -packetsize 13 /dev/null

Negative-size memcpy and endless loop Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
fc75877feb avformat/rtpenc: Reject packet sizes too small for the MPEG audio payload header
Fixes: negative-size-param
Fixes: infinite loop
Fixes: KX3pF2MSORSh
Fixes: ffmpeg -f lavfi -i sine=d=0.2 -c:a mp2 -f rtp -packetsize 13 /dev/null

Negative-size memcpy and endless loop Replicated through UnModified FFmpeg with ASAN

Found during triage of the security report TwYfznAFyatl (#22717)
2026-10-20 01:28:04 +00:00
Michael Niedermayer
b85207c8e9 avformat/rtpenc: Reject packet sizes too small for the MPEG video payload header
Fixes: negative-size-param
Fixes: infinite loop
Fixes: vrmb3QRC6jK1
Fixes: swarm-Signed-integer-underflow-in-RTP-MPEG-video-packet-length-4acadd
Fixes: ffmpeg -f lavfi -i color=size=64x64:duration=1 -packetsize 13 -c:v mpeg1video -f rtp rtp://127.0.0.1:45004

Negative-size memcpy and endless loop Replicated through UnModified FFmpeg with ASAN

Found-by: zhang xingxing <2388969553@qq.com>
2026-10-20 01:28:04 +00:00
Michael Niedermayer
4353f63c7c avformat/rtpenc: Reject packet sizes too small for the payload header
Fixes: negative-size-param
Fixes: infinite loop
Fixes: TwYfznAFyatl
Fixes: #22717
Fixes: ffmpeg -f lavfi -i testsrc=duration=0.1:size=16x16:rate=1 -c:v libvpx -f rtp -packetsize 13 rtp://127.0.0.1:9999

Negative-size memcpy and endless loop Replicated through UnModified FFmpeg with ASAN

Found-by: bird <6666242+bird@users.noreply.github.com>
2026-10-20 01:28:04 +00:00
Michael Niedermayer
cae0589065 avformat/idroqdec: continue after the declared size of the first RoQ_INFO chunk
Stream desynchronization Replicated through UnModified FFmpeg

Found during review of the fixes for the security report yyLBi9GsHV9w
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-19 23:51:00 +00:00
Michael Niedermayer
d353ea87b7 avformat/sctp: return AVERROR_EOF when the peer closes the association
Fixes: WoBBcuySgSTx
Fixes: swarm-sctp_read-returns-2-on-graceful-close-never-signalling-EOF-2a7ba0
Endless loop Replicated through UnModified FFmpeg

Found-by: zhang xingxing <2388969553@qq.com>
The report suggested not adding the stream id size when recvmsg() returns 0.
The case without max_streams was found during triage of the report.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-19 23:51:00 +00:00
Michael Niedermayer
94505b6444 avformat/idroqdec: compute the codebook and VQ packet size in 64bit
Fixes: yyLBi9GsHV9w
Packet size wraparound Replicated through UnModified FFmpeg

Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-19 23:51:00 +00:00
zhang xingxing
8b7e5d278c avformat/idroqdec: skip the whole body of a repeated RoQ_INFO chunk
The RoQ player in the Quake III Arena source (code/client/cl_cin.c) also
continues after the declared size of every RoQ_INFO chunk.

Fixes: yyLBi9GsHV9w
Fixes: swarm-RoQ_INFO-re-entry-skips-fixed-size-ignoring-chunk_size-e7709a
Stream desynchronization Replicated through UnModified FFmpeg

Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-19 23:51:00 +00:00
Martin Mirchev
5993347a1b avformat/flvenc: reject text packets too long for an AMF0 string
AV_CODEC_ID_TEXT packets are written as an AMF0 string, whose length is a
16-bit field. For text over 65535 bytes the length wrapped (e.g. 4464 for
70000 bytes) while the whole text was written, so readers misparse the
onTextData tag.

Fail on such packets before writing the tag.
Found while reviewing the metadata length fix for FLV.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-10-19 19:33:13 +00:00
Michael Niedermayer
d20d75cb9b avformat: remove the asf_o demuxer
asf_o is a second, non-default implementation of the ASF demuxer next
to asfdec_f.c. Security issues keep being reported against it, so it
is a maintenance burden without a benefit over the default demuxer.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-19 19:16:58 +00:00
Michael Niedermayer
71403a21b0 avformat/mov: append pssh init info in place instead of re-parsing the side data
Replaces O(n^2) by O(n) implementation

Fixes: Timeout
Found during triage/review of the security report
Fixes: tyKGcmR25mD8
2026-10-19 17:14:29 +02:00
Michael Niedermayer
d522eb22c2 avformat/iamf_parse: free the context when reading the descriptors fails
Fixes: heap-use-after-free
Fixes: GXcHU0CpqXBk
Fixes: ANT-2026-5PRHEUWY
Found-by: Anthropic agents; validated and reported by Ada Logics.
Suggested-by: James Almer <jamrial@gmail.com>
2026-10-19 14:57:27 +00:00
ykisana
40f2812185 avformat/mxfenc: write the actual FFV1 version in the FFV1 sub-descriptor
Fixes issue due to MXF muxer writing FFV1Version by copying byte 14 of the FFV1 codec label.
This caused incorrect version numbers, it would increase by one, so 3 became 4.
Now we save the real version in sc->version.
2026-10-19 11:53:03 +00:00
Jun Zhao
c8db684cbb avformat/apngdec: report out of order APNG chunks
The fcTL and fdAT chunks share a single sequence number, which must start
at 0 and increase by one for every chunk, with no gap and no duplicate.
Report the chunks which do not follow it, resynchronizing on the value
which was read so that the following chunks are not reported as well.

Out of order chunks are only reported and not rejected, so that files
written by encoders getting this wrong are still played.

Validate fdAT lengths and complete reads before locating the sequence
number in the packet. Resynchronize after external seeks, where the next
sequence number cannot be inferred from the previously read frame.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-19 07:23:22 +08:00
zhang xingxing
f29e8dd79e avformat/rtmpdh: fail bn_hex2bn() when bn_new() fails with GMP and mbedTLS
This is not a security issue.

Fixes: d9RoImPBG3x8
Fixes: swarm-NULL-q1-passed-to-bn_modexp-when-GMP-MbedTLS-alloc-fails-c4db13
Regression since: 78efc69e7c (GMP), 62f5c9d68b (mbedTLS)
NULL bignum passed to bn_modexp() Replicated through Modified FFmpeg with ASAN (GMP and mbedTLS builds, the q1 allocation in ff_dh_generate_public_key() made to fail)
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:47:35 +00:00
zhang xingxing
8d6ad744c6 avformat/rtmpproto: reject a llnw authentication challenge without a nonce
This is not a security issue.

Fixes: 6lFLlG49gRxf
Fixes: swarm-NULL-pointer-dereference-via-snprintf-s-with-NULL-nonce-83e8f3
Regression since: c1ea44c54d
NULL nonce passed to snprintf() Replicated through UnModified FFmpeg with a local RTMP server (the reconnect carried nonce=(null))
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:47:35 +00:00
zhang xingxing
98dd1b354b avformat/file: release the JNI references when fstat() fails in android_content_open()
This is not a security issue.

Fixes: yehJZZYu2sOZ
Fixes: swarm-JNI-resource-leak-on-fstat-failure-in-android_content_open-e505e3
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:43:31 +00:00
zhang xingxing
ec60a0b5d8 avformat/realtextdec: keep the window duration in 64 bits
This is not a security issue.

Fixes: GJrBZmxJqqm8
Fixes: swarm-Integer-truncation-of-parsed-duration-and-timestamps-1a4b12
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:43:31 +00:00
Michael Niedermayer
5ef923d052 avformat/vqf: reject more than two channels
Fixes: Timeout
Fixes: xYsvVfSX7ZHq
Fixes: swarm-Integer-overflow-in-VQF-frame_bit_len-computation-3a8153
Found-by: zhang xingxing <2388969553@qq.com>
Suggested-by: zhang xingxing <2388969553@qq.com>

Infinite loop Replicated through UnModified FFmpeg with timeout
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:43:31 +00:00
zhang xingxing
e7ae44999f avformat/iamf_reader: fix the inverted subblock duration check
This is not a security issue.

Regression since: 8665748584
Fixes: usWfwH9F2jUN
Fixes: swarm-Inverted-comparison-in-subblock_duration-validation-6190ea
Found-by: zhang xingxing <2388969553@qq.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-10-18 22:43:31 +00:00
Tom Needham
986faf44ea libavformat/demux: Don't treat IMM6 as one_in one_out
Exclude IMM6 from one-in/one-out timestamp inference so AVI probing
does not assign PTS from DTS before the H.264 reordering delay is known.

Signed-off-by: Tom Needham <06needhamt@gmail.com>
2026-10-18 20:57:53 +00:00
Tom Needham
70f7ed3914 libavformat/riff: Add IMM6 tag to ff_codec_bmp_tags
Signed-off-by: Tom Needham <06needhamt@gmail.com>
2026-10-18 20:57:52 +00:00
Kacper Michajłow
122336c1e3 avformat/Makefile: add missing streamhash dependency
The streamhash muxer calls ff_framehash_write_header() from framehash.c.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-18 19:52:49 +00:00
Michael Niedermayer
dfaa3ba5f3 avformat/avio: add avio_open_dir2() with an interrupt callback
A directory listing that blocks in a protocol could not be
interrupted; avio_open_dir2() passes an interrupt callback to the
protocol like avio_open2() does.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer
45f34b7dfe avformat/ftp: end a directory listing when the data connection ends
ffurl_read() reports the end of the data with AVERROR_EOF, which
ftp_read_dir() passed on as an error instead of ending the listing.

Fixes: avio_list_dir on a directory served by pyftpdlib 2.0.1
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer
ab3ebee9ea avformat/ftp: accept reply code 125 for MLSD
A server that finds the data connection open when it receives MLSD
replies with 125 instead of 150, which left ftp_status() waiting for
a further reply until the server dropped the control connection.
Reply code 125 is accepted for RETR and STOR already.

Fixes: avio_list_dir on a directory served by pyftpdlib 2.0.1
Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Michael Niedermayer
39d8be7754 avformat: report a failed allocation of a directory entry name
The file, ftp and libssh protocols returned the entry without a name
when duplicating the name failed.

Assisted-by: Claude
2026-10-18 03:19:28 +00:00
Zhao Zhili
34370c0ffd avformat/udp: use the circular buffer whenever threads are available
The rx and tx threads no longer use pthread_cancel(), so gate the
circular buffer on HAVE_THREADS instead of HAVE_PTHREAD_CANCEL. This
also drops the w32threads override.

On targets that have threads but no pthread_cancel(), such as Android,
udp inputs now start a receive thread and allocate the default 7*4096
by 188 byte fifo, as on other platforms. Set fifo_size=0 to get the
previous behavior.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-10-17 04:24:54 +00:00
Zhao Zhili
64b0e185fc avformat/udp: stop the rx thread without pthread_cancel()
The rx thread blocks in recvfrom() and udp_close() cancelled it. That
only works if recvfrom() is a cancellation point and if a cancel
request made while cancellation is disabled is still acted on later.
Darwin loses such a request, so closing an input that is receiving
data hangs in pthread_join(). On Win32 recvfrom() is not a
cancellation point at all, which is why udp_close() needed a separate
shutdown() and CancelIoEx() path.

Wait with ff_network_wait_fd() instead, as other protocols do. Closing
an input that receives no data can take up to POLLING_TIME.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-10-17 04:24:54 +00:00
Zhao Zhili
245f56b040 avformat/sapdec: disable the udp circular buffer
sap_fetch_packet() polls the raw socket fd to find pending
announcements and reads them itself to detect stream deletion. With
the circular buffer enabled, the rx thread competes for the same
datagrams and usually reads them first, so poll() seldom reports
POLLIN and the check becomes unreliable.

Pass fifo_size=0 as rtpproto.c does.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-10-17 04:24:54 +00:00