]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ivi_common.c
Add MxPEG decoder
[ffmpeg] / libavcodec / ivi_common.c
index f0a3a49464004b8af3123b90c29543643afa7621..0e552bccfecabe0d3be559245f7476dfb51fb78f 100644 (file)
@@ -40,7 +40,7 @@ VLC ff_ivi_mb_vlc_tabs [8];
 VLC ff_ivi_blk_vlc_tabs[8];
 
 /**
- *  Reverses "nbits" bits of the value "val" and returns the result
+ *  Reverse "nbits" bits of the value "val" and return the result
  *  in the least significant bits.
  */
 static uint16_t inv_bits(uint16_t val, int nbits)
@@ -404,6 +404,10 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
                         hi  = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
                         val = IVI_TOSIGNED((hi << 6) | lo); /* merge them and convert into signed val */
                     } else {
+                        if (sym >= 256U) {
+                            av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
+                            return -1;
+                        }
                         run = rvmap->runtab[sym];
                         val = rvmap->valtab[sym];
                     }