ffmpeg/fftools
depthfirst-dev[bot] 20a720b0f3
fftools/ffmpeg_opt: validate stream index in negative map handling
Negative -map processing iterates previously parsed stream map entries
and dereferences input_files[m->file_index]->ctx->streams[m->stream_index]
without validating that stream_index is in range.

A malformed earlier map can leave m->stream_index negative, which causes
an out-of-bounds read when a later negative map walks existing entries.
Check that stream_index is non-negative and below nb_streams before
calling stream_specifier_match().

*Vulnerability reported by Zhenpeng (Leo) Lin at depthfirst*
*Patch validated by Zheng Yu at depthfirst*

Fixes: DFVULN-695
(cherry picked from commit 25a98586cc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-05-05 15:21:19 +02:00
..
cmdutils.c fftools/cmdutils: Add protective () to FLAGS 2024-06-13 19:58:01 +02:00
cmdutils.h fftools/cmdutils: split common option handlers into their own file 2022-03-22 18:49:43 +01:00
ffmpeg.c fftools/ffmpeg: Check read() for failure 2024-07-21 18:55:33 +02:00
ffmpeg.h fftools/ffmpeg_opt: limit recursion of presets 2026-05-05 15:21:03 +02:00
ffmpeg_filter.c ffmpeg: convert to new channel layout-API 2022-03-15 09:42:46 -03:00
ffmpeg_hw.c ffmpeg_hw: make hardware selection for filters more user friendly 2021-09-12 13:33:50 -03:00
ffmpeg_mux.c ffmpeg: add option fps_mode 2022-06-11 09:47:27 +05:30
ffmpeg_opt.c fftools/ffmpeg_opt: validate stream index in negative map handling 2026-05-05 15:21:19 +02:00
ffplay.c fftools/ffplay: Check return of swr_alloc_set_opts2() 2024-06-13 11:22:08 +02:00
ffprobe.c fftools/ffprobe: support 2D arrays in print_list_fmt() 2023-12-06 16:12:39 -03:00
fopen_utf8.h fftools/fopen_utf8: support long paths on Windows for fftools 2022-06-19 01:38:23 +03:00
Makefile fftools/ffmpeg: move some muxing-related code into a separate file 2022-04-13 12:07:54 +02:00
opt_common.c tools/opt_common: Check for malloc failure 2024-06-13 11:22:08 +02:00
opt_common.h fftools/cmdutils: split common option handlers into their own file 2022-03-22 18:49:43 +01:00