From patchwork Sat Oct 12 20:34:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 15728 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C2212448EEE for ; Sat, 12 Oct 2019 23:36:03 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB30D689BC2; Sat, 12 Oct 2019 23:36:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-2.mx.upcmail.net (vie01a-dmta-pe03-2.mx.upcmail.net [62.179.121.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C3E2688120 for ; Sat, 12 Oct 2019 23:35:55 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1iJO7H-0006fe-4y for ffmpeg-devel@ffmpeg.org; Sat, 12 Oct 2019 22:35:55 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id JO6HiL1e5wlysJO6IiuDq0; Sat, 12 Oct 2019 22:34:54 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=E5OzWpVl c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=YESDpcI3frS5GbqQPgwA:9 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 12 Oct 2019 22:34:03 +0200 Message-Id: <20191012203403.26941-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191012203403.26941-1-michael@niedermayer.cc> References: <20191012203403.26941-1-michael@niedermayer.cc> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfA8WjNHnA2vehdmHgoI0xAIK73JwSj25B8WdzKd87wjvfFFmP8Z9fjOeQQ4b81P9HxvLs5KgriDkKsaFPwRBZ8+g4qE1vVk9VAVcoANhJ4QMepT5RH1m t7Bfep8VjD5wvmMLI0muZpds4RwGl+talxc+3zSUswTciWHFIMEA6Liy Subject: [FFmpeg-devel] [PATCH 4/4] tools/target_dec_fuzzer: Also fuzz keyframe & disposal flags X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This should improve coverage Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 0047c9eed6..4d03151735 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -109,6 +109,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int *got_picture_ptr, const AVPacket *avpkt) = NULL; AVCodecParserContext *parser = NULL; + uint64_t keyframes = 0; if (!c) { @@ -191,6 +192,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ctx->channels = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS; ctx->block_align = bytestream2_get_le32(&gbc); ctx->codec_tag = bytestream2_get_le32(&gbc); + keyframes = bytestream2_get_le64(&gbc); if (extradata_size < size) { ctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); @@ -236,6 +238,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (res < 0) error("Failed memory allocation"); memcpy(parsepkt.data, last, data - last); + parsepkt.flags = (keyframes & 1) * AV_PKT_FLAG_DISCARD + (keyframes & 2)/2 * AV_PKT_FLAG_KEY; + keyframes = (keyframes >> 2) + (keyframes<<62); data += sizeof(fuzz_tag); last = data;