]> git.tue.mpg.de Git - paraslash.git/commitdiff
wmadec: Properly handle empty outputs.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 1 Nov 2016 05:10:00 +0000 (06:10 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 8 Dec 2016 18:42:18 +0000 (19:42 +0100)
If out_size is zero we try to shrink the buffer to size zero. POSIX
says that the behavior is implementation-defined in this case, and
para_realloc() aborts due to an assert() statement that checks for
size zero. This patch makes sure the wma decoder never calls realloc()
with a zero size argument.

wmadec_filter.c

index 0dff2b7914a0e1f1e18afc412bbd331bfe32f648..48257c19b11de385e999f96706b9ca83632ea4a4 100644 (file)
@@ -1237,9 +1237,11 @@ next_buffer:
                free(out);
                goto err;
        }
-       out = para_realloc(out, out_size);
-       if (out_size > 0)
+       if (out_size > 0) {
+               out = para_realloc(out, out_size);
                btr_add_output(out, out_size, btrn);
+       } else
+               free(out);
        converted += ret + WMA_FRAME_SKIP;
 success:
        btr_consume(btrn, converted);