mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Make sure we dont read over the end.
Fixes issue1237. Originally committed as revision 19322 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
edb501c45b
commit
37458d7e1b
@ -729,10 +729,17 @@ static void decode_422_bitstream(HYuvContext *s, int count){
|
|||||||
|
|
||||||
count/=2;
|
count/=2;
|
||||||
|
|
||||||
|
if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*4)){
|
||||||
|
for(i=0; i<count && get_bits_count(&s->gb) < s->gb.size_in_bits; i++){
|
||||||
|
READ_2PIX(s->temp[0][2*i ], s->temp[1][i], 1);
|
||||||
|
READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
for(i=0; i<count; i++){
|
for(i=0; i<count; i++){
|
||||||
READ_2PIX(s->temp[0][2*i ], s->temp[1][i], 1);
|
READ_2PIX(s->temp[0][2*i ], s->temp[1][i], 1);
|
||||||
READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
|
READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_gray_bitstream(HYuvContext *s, int count){
|
static void decode_gray_bitstream(HYuvContext *s, int count){
|
||||||
@ -740,9 +747,15 @@ static void decode_gray_bitstream(HYuvContext *s, int count){
|
|||||||
|
|
||||||
count/=2;
|
count/=2;
|
||||||
|
|
||||||
|
if(count >= (s->gb.size_in_bits - get_bits_count(&s->gb))/(31*2)){
|
||||||
|
for(i=0; i<count && get_bits_count(&s->gb) < s->gb.size_in_bits; i++){
|
||||||
|
READ_2PIX(s->temp[0][2*i ], s->temp[0][2*i+1], 0);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
for(i=0; i<count; i++){
|
for(i=0; i<count; i++){
|
||||||
READ_2PIX(s->temp[0][2*i ], s->temp[0][2*i+1], 0);
|
READ_2PIX(s->temp[0][2*i ], s->temp[0][2*i+1], 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
|
#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
|
||||||
|
Loading…
Reference in New Issue
Block a user