Commit ab7dbdc9 authored by Stefano Sabatini's avatar Stefano Sabatini

lavc/rawdec: add assertion check in raw_decode()

Check on an implicit assumption done on the number of coded bits for
paletted rawvideo with coded bits == 2.
parent 17a54f5d
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "imgconvert.h" #include "imgconvert.h"
#include "raw.h" #include "raw.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
...@@ -179,6 +180,7 @@ static int raw_decode(AVCodecContext *avctx, ...@@ -179,6 +180,7 @@ static int raw_decode(AVCodecContext *avctx,
} }
linesize_align = 8; linesize_align = 8;
} else { } else {
av_assert0(avctx->bits_per_coded_sample == 2);
for(i=0; 4*i+3 < buf_size && i<avpkt->size; i++){ for(i=0; 4*i+3 < buf_size && i<avpkt->size; i++){
dst[4*i+0]= buf[i]>>6; dst[4*i+0]= buf[i]>>6;
dst[4*i+1]= buf[i]>>4&3; dst[4*i+1]= buf[i]>>4&3;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment