ffmpeg | branch: master | Anton Khirnov <an...@khirnov.net> | Sun Sep  1 
15:41:24 2024 +0200| [eec1a7a6bb952c09945d908d2d5de35909516778] | committer: 
Anton Khirnov

lavc/hevc: check framerate num/den to be strictly positive

Rather than just != 0. These values are read as uint32 and can become
negative when cast to int.

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

 libavcodec/hevc/hevcdec.c | 2 +-
 libavcodec/hevc/parser.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 6b596f1573..c8c425fd71 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -392,7 +392,7 @@ static void export_stream_params(HEVCContext *s, const 
HEVCSPS *sps)
         den = sps->vui.vui_time_scale;
     }
 
-    if (num != 0 && den != 0)
+    if (num > 0 && den > 0)
         av_reduce(&avctx->framerate.den, &avctx->framerate.num,
                   num, den, 1 << 30);
 }
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 8db56e259e..2d14b4fae2 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -101,7 +101,7 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, 
H2645NAL *nal,
         den = sps->vui.vui_time_scale;
     }
 
-    if (num != 0 && den != 0)
+    if (num > 0 && den > 0)
         av_reduce(&avctx->framerate.den, &avctx->framerate.num,
                   num, den, 1 << 30);
 

_______________________________________________
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