shithub: dav1d

Download patch

ref: bbcaf4115586ac33d5b4350a8b3fd87dbbb6d71f
parent: b7c64ad69171d0d8890ab3bf385f295faa24cda5
author: Janne Grunau <janne-vlc@jannau.net>
date: Mon Nov 26 07:50:25 EST 2018

fuzzer: use dav1d_parse_sequence_header()

Should increase function coverage in oss-fuzz to 100%.

--- a/tests/libfuzzer/dav1d_fuzzer.c
+++ b/tests/libfuzzer/dav1d_fuzzer.c
@@ -61,6 +61,7 @@
     Dav1dContext * ctx = NULL;
     Dav1dPicture pic;
     const uint8_t *ptr = data;
+    int have_seq_hdr = 0;
     int err;
 
     dav1d_version();
@@ -101,6 +102,17 @@
             break;
 
         if (!frame_size) continue;
+
+        if (!have_seq_hdr) {
+            Dav1dSequenceHeader seq = { 0 };
+            int err = dav1d_parse_sequence_header(&seq, ptr, frame_size);
+            // skip frames until we see a sequence header
+            if  (err != 0) {
+                ptr += frame_size;
+                continue;
+            }
+            have_seq_hdr = 1;
+        }
 
         // copy frame data to a new buffer to catch reads past the end of input
         p = dav1d_data_create(&buf, frame_size);