aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-09-19 23:33:49 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-09-24 15:37:17 +0200
commit74385dd496bdcda9a6e029fabf4946f2234a0d13 (patch)
treeda5aa07edd7fcca8f60bceca62f887f21ac96515
parent36924fa306271c3a8fdfee451a716d0da3fc6972 (diff)
downloadffmpeg-74385dd496bdcda9a6e029fabf4946f2234a0d13.tar.gz
avcodec/encode: Check bitrate
Fixes: -1.80923e+19 is outside the range of representable values of type 'long' Fixes: 71103/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6542773681979392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/encode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index bc5acf985d..3baf5b8103 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -764,6 +764,11 @@ int ff_encode_preinit(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
+ if (avctx->bit_rate < 0) {
+ av_log(avctx, AV_LOG_ERROR, "The encoder bitrate is negative.\n");
+ return AVERROR(EINVAL);
+ }
+
if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE &&
!(avctx->codec->capabilities & AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE)) {
av_log(avctx, AV_LOG_ERROR, "The copy_opaque flag is set, but the "