[FFmpeg-cvslog] avcodec/osq: Implement flush()

Michael Niedermayer git at videolan.org
Fri Dec 29 01:45:55 EET 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Sep 20 23:53:21 2023 +0200| [c75fccd1d417f288b1ea7f76824f6a6ea652ea92] | committer: Michael Niedermayer

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 at niedermayer.cc>

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

 libavcodec/osq.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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,
 };



More information about the ffmpeg-cvslog mailing list