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.
release/7.1
Anton Khirnov 5 months ago
parent fc8df81cb1
commit eec1a7a6bb
  1. 2
      libavcodec/hevc/hevcdec.c
  2. 2
      libavcodec/hevc/parser.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);
}

@ -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);

Loading…
Cancel
Save