]> granicus.if.org Git - libvpx/commitdiff
Fixed the buffer overflow issue
authorJingning Han <jingning@google.com>
Wed, 20 Feb 2013 23:32:17 +0000 (15:32 -0800)
committerJingning Han <jingning@google.com>
Wed, 20 Feb 2013 23:41:48 +0000 (15:41 -0800)
The issue that potentially broke the encoding process was due to the fact
that the length of token link is calculated from the total number of tokens
coded, while it is possible, in high bit-rate setting, this length is
greater than the buffer length initially assigned to the cpi->tok.

This patch increases the initially allocated buffer length assigned to
cpi->tok from
(mb_rows * mb_cols * 24 * 16) to (mb_rows * mb_cols * (1 + 24 * 16)).

It resolves the buffer overflow problem.

Change-Id: I8661a8d39ea0a3c24303e3f71a170787a1d5b1df

vp9/encoder/vp9_onyx_if.c

index 2528122a6e801394b05489f22a34a60a0a2cbaef..9355c02a1bf5321ce8cfe134557921ac5bc60aad 100644 (file)
@@ -947,7 +947,7 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
   vpx_free(cpi->tok);
 
   {
-    unsigned int tokens = cm->mb_rows * cm->mb_cols * 24 * 16;
+    unsigned int tokens = cm->mb_rows * cm->mb_cols * (24 * 16 + 1);
 
     CHECK_MEM_ERROR(cpi->tok, vpx_calloc(tokens, sizeof(*cpi->tok)));
   }