[FFmpeg-devel] [PATCH v2] tools/target_dec_fuzzer: use refcounted packets

Tomas Härdin tjoppen at acc.umu.se
Wed Aug 21 12:15:29 EEST 2019


tis 2019-08-20 klockan 21:05 -0300 skrev James Almer:
> Should reduce date copying considerably.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Fixed a stupid mistake when checking the return value for av_new_packet().
> Still untested.

Works great for me. Should make fuzzing faster overall, better use of
computing resources imo

> @@ -186,6 +144,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
>          error("Failed memory allocation");
>  
>      ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs
> +    ctx->refcounted_frames = 1;

Could maybe have a comment that this is also to reduce false positives,
or that we want to focus on the new API rather than the old one

> @@ -240,7 +199,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
>          if (data + sizeof(fuzz_tag) > end)
>              data = end;
>  
> -        FDBPrepare(&buffer, &parsepkt, last, data - last);
> +        res = av_new_packet(&parsepkt, data - last);
> +        if (res < 0)
> +            error("Failed memory allocation");
> +        memcpy(parsepkt.data, last, data - last);

Is there some way to avoid this copy?

/Tomas



More information about the ffmpeg-devel mailing list