Mercurial > libavcodec.hg
comparison asv1.c @ 2422:18b8b2dcc037 libavcodec
various security fixes and precautionary checks
author | michael |
---|---|
date | Wed, 12 Jan 2005 00:16:25 +0000 |
parents | 26560d4fdb1f |
children | 1ee03f2a6cd5 |
comparison
equal
deleted
inserted
replaced
2421:e326490f58c4 | 2422:18b8b2dcc037 |
---|---|
337 } | 337 } |
338 } | 338 } |
339 return 0; | 339 return 0; |
340 } | 340 } |
341 | 341 |
342 static inline void encode_mb(ASV1Context *a, DCTELEM block[6][64]){ | 342 static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){ |
343 int i; | 343 int i; |
344 | |
345 if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < 30*16*16*3/2/8){ | |
346 av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n"); | |
347 return -1; | |
348 } | |
344 | 349 |
345 if(a->avctx->codec_id == CODEC_ID_ASV1){ | 350 if(a->avctx->codec_id == CODEC_ID_ASV1){ |
346 for(i=0; i<6; i++) | 351 for(i=0; i<6; i++) |
347 asv1_encode_block(a, block[i]); | 352 asv1_encode_block(a, block[i]); |
348 }else{ | 353 }else{ |
349 for(i=0; i<6; i++) | 354 for(i=0; i<6; i++) |
350 asv2_encode_block(a, block[i]); | 355 asv2_encode_block(a, block[i]); |
351 } | 356 } |
357 return 0; | |
352 } | 358 } |
353 | 359 |
354 static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){ | 360 static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){ |
355 DCTELEM (*block)[64]= a->block; | 361 DCTELEM (*block)[64]= a->block; |
356 int linesize= a->picture.linesize[0]; | 362 int linesize= a->picture.linesize[0]; |