2011/5/5 Jindřich Makovička <makov...@gmail.com>
>
> Hi,
>
> although I don't know much about wma voice, I think this piece of code
> doesn't do what is expected (sizeof returns the size of pointer in
> this case, i.e. 4 or 8 based on arch, not 25).
>
> decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
> {
> ...
>    memset(vbm_tree, 0xff, sizeof(vbm_tree));
>

Thanks.
From 0c4f2497d51632607b8eeb060a1abc3a9ec73712 Mon Sep 17 00:00:00 2001
From: Alex Converse <aconve...@google.com>
Date: Thu, 5 May 2011 11:10:19 -0700
Subject: [PATCH] wmavoice: Use proper size in memeset().
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1"

This is a multi-part message in MIME format.
--------------1
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


sizeof(array_functrion_argument) gives the size of the pointer type not
the size of the array to which it points.
---
 libavcodec/wmavoice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--------------1
Content-Type: text/x-patch; name="0001-wmavoice-Use-proper-size-in-memeset.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-wmavoice-Use-proper-size-in-memeset.patch"

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 8dea30c..4e69b83 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -315,7 +315,7 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
     };
     int cntr[8], n, res;
 
-    memset(vbm_tree, 0xff, sizeof(vbm_tree));
+    memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
     memset(cntr,     0,    sizeof(cntr));
     for (n = 0; n < 17; n++) {
         res = get_bits(gb, 3);

--------------1--


_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to