[FFmpeg-cvslog] fftools/ffmpeg: prefer real errors over EOF in err_merge()
Anton Khirnov
git at videolan.org
Wed Jul 24 10:08:11 EEST 2024
ffmpeg | branch: release/6.1 | Anton Khirnov <anton at khirnov.net> | Tue Jul 23 15:11:08 2024 +0200| [159270e3b2fc51f0d0c65411359a17c15bc520ed] | committer: Anton Khirnov
fftools/ffmpeg: prefer real errors over EOF in err_merge()
Fixes an issue in 6.1 when reading a corrupted file with -xerror would
exit with success. This specific issue is not present in master, but
this should generally be a more robust behaviour.
Reported-by: Andrej Peterka
(cherry picked from commit d1fa39d08d3bce9c268cd02cb3c45a76e63b6ff4)
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=159270e3b2fc51f0d0c65411359a17c15bc520ed
---
fftools/ffmpeg.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 0983d026cd..25604e05a5 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -883,11 +883,12 @@ void update_benchmark(const char *fmt, ...);
/**
* Merge two return codes - return one of the error codes if at least one of
* them was negative, 0 otherwise.
- * Currently just picks the first one, eventually we might want to do something
- * more sophisticated, like sorting them by priority.
*/
static inline int err_merge(int err0, int err1)
{
+ // prefer "real" errors over EOF
+ if ((err0 >= 0 || err0 == AVERROR_EOF) && err1 < 0)
+ return err1;
return (err0 < 0) ? err0 : FFMIN(err1, 0);
}
More information about the ffmpeg-cvslog
mailing list