comparison libmpcodecs/vd_ffmpeg.c @ 22147:f4f90f0f5d2b

Add missing checks in RealVideo slice handling code.
author reimar
date Tue, 06 Feb 2007 18:30:56 +0000
parents acac2d8bc25f
children 1f6c89bc1c3a
comparison
equal deleted inserted replaced
22146:9b6273ea9ce9 22147:f4f90f0f5d2b
762 || sh->format == mmioFOURCC('R', 'V', '3', '0') 762 || sh->format == mmioFOURCC('R', 'V', '3', '0')
763 || sh->format == mmioFOURCC('R', 'V', '4', '0')) 763 || sh->format == mmioFOURCC('R', 'V', '4', '0'))
764 if(sh->bih->biSize>=sizeof(*sh->bih)+8){ 764 if(sh->bih->biSize>=sizeof(*sh->bih)+8){
765 int i; 765 int i;
766 dp_hdr_t *hdr= (dp_hdr_t*)data; 766 dp_hdr_t *hdr= (dp_hdr_t*)data;
767 uint32_t *offsets = (uint32_t*)(data + hdr->chunktab) + 1;
768 char *end = data + len;
767 769
768 if(avctx->slice_offset==NULL) 770 if(avctx->slice_offset==NULL)
769 avctx->slice_offset= av_malloc(sizeof(int)*1000); 771 avctx->slice_offset= av_malloc(sizeof(int)*1000);
770 772
771 // for(i=0; i<25; i++) printf("%02X ", ((uint8_t*)data)[i]); 773 // for(i=0; i<25; i++) printf("%02X ", ((uint8_t*)data)[i]);
772 774
773 avctx->slice_count= hdr->chunks+1; 775 avctx->slice_count= FFMIN(hdr->chunks+1, 1000);
774 for(i=0; i<avctx->slice_count; i++) 776 for(i=0; i<avctx->slice_count && end >= &offsets[2*i+1]; i++)
775 avctx->slice_offset[i]= ((uint32_t*)(data+hdr->chunktab))[2*i+1]; 777 avctx->slice_offset[i]= offsets[2*i];
776 len=hdr->len; 778 len=hdr->len;
777 data+= sizeof(dp_hdr_t); 779 data+= sizeof(dp_hdr_t);
778 } 780 }
779 781
780 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n", 782 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n",