From 8eaa28075189eea5db470422e8b4110df723cce3 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 1 Nov 2016 06:10:00 +0100 Subject: [PATCH] wmadec: Properly handle empty outputs. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wmadec_filter.c b/wmadec_filter.c index 0dff2b79..48257c19 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -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); -- 2.39.2