comparison h264.c @ 3126:05a10f97d510 libavcodec

fix some crashes on negative nalsize.
author lorenm
date Tue, 14 Feb 2006 05:40:53 +0000
parents 16f9d33c027d
children dd3f6be492bd
comparison
equal deleted inserted replaced
3125:16f9d33c027d 3126:05a10f97d510
7505 if(h->is_avc) { 7505 if(h->is_avc) {
7506 if(buf_index >= buf_size) break; 7506 if(buf_index >= buf_size) break;
7507 nalsize = 0; 7507 nalsize = 0;
7508 for(i = 0; i < h->nal_length_size; i++) 7508 for(i = 0; i < h->nal_length_size; i++)
7509 nalsize = (nalsize << 8) | buf[buf_index++]; 7509 nalsize = (nalsize << 8) | buf[buf_index++];
7510 if(nalsize <= 1){
7511 if(nalsize == 1){
7512 buf_index++;
7513 continue;
7514 }else{
7515 av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
7516 break;
7517 }
7518 }
7510 } else { 7519 } else {
7511 // start code prefix search 7520 // start code prefix search
7512 for(; buf_index + 3 < buf_size; buf_index++){ 7521 for(; buf_index + 3 < buf_size; buf_index++){
7513 // this should allways succeed in the first iteration 7522 // this should allways succeed in the first iteration
7514 if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1) 7523 if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1)