Add assertion in av1_set_coeff_buffer()

To check if cb_offset is valid.

Change-Id: If1ea4fca9890775f55d4786089745ed6d9ed0da2
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 3581066..d4b575b 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1401,7 +1401,7 @@
   x->e_mbd.mi[0]->mbmi.partition = partition;
   update_state(cpi, tile_data, td, ctx, mi_row, mi_col, bsize, dry_run);
 
-  av1_set_coeff_buffer(cpi, x, mi_row, mi_col);
+  if (!dry_run) av1_set_coeff_buffer(cpi, x, mi_row, mi_col);
 
   encode_superblock(cpi, tile_data, td, tp, dry_run, mi_row, mi_col, bsize,
                     rate);
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index fd6f618..9da6984 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -82,6 +82,7 @@
   int offset = (mi_row >> mib_size_log2) * stride + (mi_col >> mib_size_log2);
   CB_COEFF_BUFFER *coeff_buf = &cpi->coeff_buffer_base[offset];
   const int txb_offset = x->cb_offset / (TX_SIZE_W_MIN * TX_SIZE_H_MIN);
+  assert(x->cb_offset < (1 << num_pels_log2_lookup[cm->seq_params.sb_size]));
   for (int plane = 0; plane < num_planes; ++plane) {
     x->mbmi_ext->tcoeff[plane] = coeff_buf->tcoeff[plane] + x->cb_offset;
     x->mbmi_ext->eobs[plane] = coeff_buf->eobs[plane] + txb_offset;