Commit 87a7fc69 authored by Michael Niedermayer's avatar Michael Niedermayer

tools/target_dec_fuzzer: fuzz channels and sample_rate too

This should increase coverage over more audio decoders.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 83f2555e
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
//For FF_SANE_NB_CHANNELS, so we dont waste energy testing things that will get instantly rejected
#include "libavcodec/internal.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
extern AVCodec * codec_list[]; extern AVCodec * codec_list[];
...@@ -170,6 +173,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ...@@ -170,6 +173,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
parser = av_parser_init(c->id); parser = av_parser_init(c->id);
extradata_size = bytestream2_get_le32(&gbc); extradata_size = bytestream2_get_le32(&gbc);
ctx->sample_rate = bytestream2_get_le32(&gbc);
ctx->channels = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
if (extradata_size < size) { if (extradata_size < size) {
ctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); ctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (ctx->extradata) { if (ctx->extradata) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment