ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Mon Jun 10 15:20:23 2024 +0200| [c84e40d9e6cec745edee52fc801737d71ab89543] | 
committer: Andreas Rheinhardt

fftools/ffmpeg_mux_init: Return error upon error

Currently it may return an uninitialized value.
Introduced in 840f2bc18eddd72fa886aec30efc82991b920c45.
Fixes Coverity issue #1603565.

Reviewed-by: Anton Khirnov <an...@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c84e40d9e6cec745edee52fc801737d71ab89543
---

 fftools/ffmpeg_mux_init.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index b1cb6cf7bd..2ed4171a75 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -3022,10 +3022,14 @@ 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;
+            }
+            size += nb_ch - 1;
+            pts = av_realloc_f(pts, size, sizeof(*pts));
+            if (!pts)
+                return AVERROR(ENOMEM);
 
             if (p[8]) {
                 ret = av_parse_time(&t, p + 8, 1);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to