aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-09-20 23:53:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-12-29 00:45:20 +0100
commitc75fccd1d417f288b1ea7f76824f6a6ea652ea92 (patch)
treeb0e4ea5a273edee47bc220159eb0f46390dded27
parent545686e49e37242a727de3f00e6bf1aef861449e (diff)
downloadffmpeg-c75fccd1d417f288b1ea7f76824f6a6ea652ea92.tar.gz
avcodec/osq: Implement flush()
Fixes: out of array access Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6227491892887552 Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6268561729126400 Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6414805046788096 Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6538151088488448 Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6608131540779008 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/osq.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/osq.c b/libavcodec/osq.c
index 435f3ea7f6..f47213bf0c 100644
--- a/libavcodec/osq.c
+++ b/libavcodec/osq.c
@@ -61,6 +61,14 @@ typedef struct OSQContext {
int pkt_offset;
} OSQContext;
+static void osq_flush(AVCodecContext *avctx)
+{
+ OSQContext *s = avctx->priv_data;
+
+ s->bitstream_size = 0;
+ s->pkt_offset = 0;
+}
+
static av_cold int osq_close(AVCodecContext *avctx)
{
OSQContext *s = avctx->priv_data;
@@ -478,4 +486,5 @@ const FFCodec ff_osq_decoder = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_NONE },
+ .flush = osq_flush,
};