[FFmpeg-devel] [PATCH] fftools/ffmpeg_mux_init: Return error upon error
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Jun 10 16:24:49 EEST 2024
Currently it may return an uninitialized value.
Introduced in 840f2bc18eddd72fa886aec30efc82991b920c45.
Fixes Coverity issue #1603565.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
fftools/ffmpeg_mux_init.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index b1cb6cf7bd..1953655135 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -3022,10 +3022,13 @@ static int parse_forced_key_frames(void *log, KeyframeForceCtx *kf,
unsigned int nb_ch = mux->fc->nb_chapters;
int j;
- if (nb_ch > INT_MAX - size ||
- !(pts = av_realloc_f(pts, size += nb_ch - 1,
- sizeof(*pts))))
+ if (nb_ch > INT_MAX - size) {
+ ret = AVERROR(ERANGE);
goto fail;
+ }
+ pts = av_realloc_f(pts, size += nb_ch - 1, sizeof(*pts));
+ if (!pts)
+ return AVERROR(ENOMEM);
if (p[8]) {
ret = av_parse_time(&t, p + 8, 1);
--
2.40.1
More information about the ffmpeg-devel
mailing list