]> granicus.if.org Git - libvpx/commitdiff
Cast buffer offset to int64_t
authorJerome Jiang <jianj@google.com>
Fri, 10 May 2019 18:46:19 +0000 (11:46 -0700)
committerJerome Jiang <jianj@google.com>
Fri, 10 May 2019 18:46:19 +0000 (11:46 -0700)
To prevent integer overflow with extreme frame sizes.

Change-Id: Ib77f1c11f0264257d9e6c162f474d637592e7b09

vp9/encoder/vp9_pickmode.c

index 60cc54e98b04b5bb5226e4879dbda2dbace8b83b..d6052fade85e2a9307b95e4a4a0b2658a1b76e72 100644 (file)
@@ -410,8 +410,8 @@ static void compute_intra_yprediction(PREDICTION_MODE mode, BLOCK_SIZE bsize,
   for (row = 0; row < max_blocks_high; row += (1 << tx_size)) {
     // Skip visiting the sub blocks that are wholly within the UMV.
     for (col = 0; col < max_blocks_wide; col += (1 << tx_size)) {
-      p->src.buf = &src_buf_base[4 * (row * src_stride + col)];
-      pd->dst.buf = &dst_buf_base[4 * (row * dst_stride + col)];
+      p->src.buf = &src_buf_base[4 * (row * (int64_t)src_stride + col)];
+      pd->dst.buf = &dst_buf_base[4 * (row * (int64_t)dst_stride + col)];
       vp9_predict_intra_block(xd, b_width_log2_lookup[bsize], tx_size, mode,
                               x->skip_encode ? p->src.buf : pd->dst.buf,
                               x->skip_encode ? src_stride : dst_stride,
@@ -1055,8 +1055,8 @@ static void estimate_block_intra(int plane, int block, int row, int col,
 
   (void)block;
 
-  p->src.buf = &src_buf_base[4 * (row * src_stride + col)];
-  pd->dst.buf = &dst_buf_base[4 * (row * dst_stride + col)];
+  p->src.buf = &src_buf_base[4 * (row * (int64_t)src_stride + col)];
+  pd->dst.buf = &dst_buf_base[4 * (row * (int64_t)dst_stride + col)];
   // Use source buffer as an approximation for the fully reconstructed buffer.
   vp9_predict_intra_block(xd, b_width_log2_lookup[plane_bsize], tx_size,
                           args->mode, x->skip_encode ? p->src.buf : pd->dst.buf,