[FFmpeg-cvslog] cngdec: Fix the memset size to cover the full array

Martin Storsjö git at videolan.org
Wed Oct 31 13:47:06 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Oct 30 12:17:35 2012 +0200| [cafefd889b9e9f36814dc4ca13ed169f667b41a4] | committer: Martin Storsjö

cngdec: Fix the memset size to cover the full array

This was a leftover from previous iterations of the code, where the
refl coef arrays were statically allocated.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cafefd889b9e9f36814dc4ca13ed169f667b41a4
---

 libavcodec/cngdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c
index 8cfe9cf..c05bfd9 100644
--- a/libavcodec/cngdec.c
+++ b/libavcodec/cngdec.c
@@ -108,7 +108,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
     if (avpkt->size) {
         float dbov = -avpkt->data[0] / 10.0;
         p->target_energy = 1081109975 * pow(10, dbov) * 0.75;
-        memset(p->target_refl_coef, 0, sizeof(p->refl_coef));
+        memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
         for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
             p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
         }



More information about the ffmpeg-cvslog mailing list