comparison vp3.c @ 2422:18b8b2dcc037 libavcodec

various security fixes and precautionary checks
author michael
date Wed, 12 Jan 2005 00:16:25 +0000
parents 26560d4fdb1f
children acfea8a94bf8
comparison
equal deleted inserted replaced
2421:e326490f58c4 2422:18b8b2dcc037
2091 stride = s->current_frame.linesize[2]; 2091 stride = s->current_frame.linesize[2];
2092 if (!s->flipped_image) stride = -stride; 2092 if (!s->flipped_image) stride = -stride;
2093 upper_motion_limit = 7 * s->current_frame.linesize[2]; 2093 upper_motion_limit = 7 * s->current_frame.linesize[2];
2094 lower_motion_limit = height * s->current_frame.linesize[2] + width - 8; 2094 lower_motion_limit = height * s->current_frame.linesize[2] + width - 8;
2095 } 2095 }
2096
2097 if((unsigned)stride > 2048)
2098 return; //various tables are fixed size
2096 2099
2097 /* for each fragment row... */ 2100 /* for each fragment row... */
2098 for (y = 0; y < height; y += 8) { 2101 for (y = 0; y < height; y += 8) {
2099 2102
2100 /* for each fragment in a row... */ 2103 /* for each fragment in a row... */
2678 av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n"); 2681 av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
2679 } 2682 }
2680 2683
2681 s->width = get_bits(&gb, 16) << 4; 2684 s->width = get_bits(&gb, 16) << 4;
2682 s->height = get_bits(&gb, 16) << 4; 2685 s->height = get_bits(&gb, 16) << 4;
2686
2687 if(avcodec_check_dimensions(avctx, s->width, s->height)){
2688 s->width= s->height= 0;
2689 return -1;
2690 }
2683 2691
2684 skip_bits(&gb, 24); /* frame width */ 2692 skip_bits(&gb, 24); /* frame width */
2685 skip_bits(&gb, 24); /* frame height */ 2693 skip_bits(&gb, 24); /* frame height */
2686 2694
2687 skip_bits(&gb, 8); /* offset x */ 2695 skip_bits(&gb, 8); /* offset x */