diff mbox series

[FFmpeg-devel,5/6] tools/target_dec_fuzzer: assume that discarded audio packets produced max samples

Message ID 20200925222638.23675-5-michael@niedermayer.cc
State Accepted
Commit c0c6b68ddbe6f7d35e2cb62a7c44970f9475eddd
Headers show
Series [FFmpeg-devel,1/6] avcodec/dxtory: Fix get_raw_size() for YUV
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Michael Niedermayer Sept. 25, 2020, 10:26 p.m. UTC
We do not know how many samples these produce as its not exported.
Alternatively we could export that but as long as its not we better
assume its more than 0 as otherwise the thresholds would not work

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 tools/target_dec_fuzzer.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer Oct. 18, 2020, 7:28 p.m. UTC | #1
On Sat, Sep 26, 2020 at 12:26:37AM +0200, Michael Niedermayer wrote:
> We do not know how many samples these produce as its not exported.
> Alternatively we could export that but as long as its not we better
> assume its more than 0 as otherwise the thresholds would not work
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  tools/target_dec_fuzzer.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index db1c6d35a6..6b75e006e6 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -344,6 +344,11 @@  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
             if (ec_pixels > maxpixels)
                 goto maximums_reached;
 
+            if (ctx->codec_type == AVMEDIA_TYPE_AUDIO &&
+                frame->nb_samples == 0 && !got_frame &&
+                (avpkt.flags & AV_PKT_FLAG_DISCARD))
+                nb_samples += ctx->max_samples;
+
             nb_samples += frame->nb_samples;
             if (nb_samples > maxsamples)
                 goto maximums_reached;