[FFmpeg-devel] [PATCH 3/5] avformat/mxfdec: also check for non-positive number of channels

Marton Balint cus at passwd.hu
Mon Nov 29 02:59:28 EET 2021


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/mxfdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8cb66b73c4..e0a52e3883 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2843,8 +2843,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 
             current_channel = 0;
 
-            if (descriptor->channels >= FF_SANE_NB_CHANNELS) {
-                av_log(mxf->fc, AV_LOG_ERROR, "max number of channels %d reached\n", FF_SANE_NB_CHANNELS);
+            if (descriptor->channels <= 0 || descriptor->channels >= FF_SANE_NB_CHANNELS) {
+                av_log(mxf->fc, AV_LOG_ERROR, "Invalid number of channels %d, must be less than %d\n", descriptor->channels, FF_SANE_NB_CHANNELS);
                 return AVERROR_INVALIDDATA;
             }
 
-- 
2.31.1



More information about the ffmpeg-devel mailing list