shithub: dav1d

Download patch

ref: 14388c3c6b53a5c2fea329e36693fd092042d392
parent: e890a66f773d12d0680a6fe50807800921dac504
author: Janne Grunau <janne-vlc@jannau.net>
date: Thu Nov 15 15:35:27 EST 2018

call dav1d_get_picture() until it returns -EAGAIN for draining

With the decoupled decoding data there might be remaining input data during
draining which can cause bitstream parsing errors.

--- a/tests/libfuzzer/dav1d_fuzzer.c
+++ b/tests/libfuzzer/dav1d_fuzzer.c
@@ -121,7 +121,7 @@
         err = dav1d_get_picture(ctx, &pic);
         if (err == 0)
             dav1d_picture_unref(&pic);
-    } while (err == 0);
+    } while (err != -EAGAIN);
 
 cleanup:
     dav1d_flush(ctx);
--- a/tools/dav1d.c
+++ b/tools/dav1d.c
@@ -151,9 +151,10 @@
             if (res != -EAGAIN) {
                 fprintf(stderr, "Error decoding frame: %s\n",
                         strerror(-res));
-            } else
+            } else {
                 res = 0;
-            break;
+                break;
+            }
         } else {
             if (!n_out) {
                 if ((res = output_open(&out, cli_settings.muxer,