comparison flacdec.c @ 9130:721e21aca252 libavcodec

flacdec: Check curr_bps after wasted bits are subtracted.
author jbr
date Wed, 04 Mar 2009 23:10:40 +0000
parents 7f11c330c5d6
children dfa6b3358c61
comparison
equal deleted inserted replaced
9129:913ae1f5c090 9130:721e21aca252
430 s->curr_bps++; 430 s->curr_bps++;
431 } else { 431 } else {
432 if (s->decorrelation == LEFT_SIDE || s->decorrelation == MID_SIDE) 432 if (s->decorrelation == LEFT_SIDE || s->decorrelation == MID_SIDE)
433 s->curr_bps++; 433 s->curr_bps++;
434 } 434 }
435 if (s->curr_bps > 32) {
436 ff_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
437 return -1;
438 }
439 435
440 if (get_bits1(&s->gb)) { 436 if (get_bits1(&s->gb)) {
441 av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n"); 437 av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");
442 return -1; 438 return -1;
443 } 439 }
446 if (get_bits1(&s->gb)) { 442 if (get_bits1(&s->gb)) {
447 wasted = 1; 443 wasted = 1;
448 while (!get_bits1(&s->gb)) 444 while (!get_bits1(&s->gb))
449 wasted++; 445 wasted++;
450 s->curr_bps -= wasted; 446 s->curr_bps -= wasted;
447 }
448 if (s->curr_bps > 32) {
449 ff_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
450 return -1;
451 } 451 }
452 452
453 //FIXME use av_log2 for types 453 //FIXME use av_log2 for types
454 if (type == 0) { 454 if (type == 0) {
455 tmp = get_sbits_long(&s->gb, s->curr_bps); 455 tmp = get_sbits_long(&s->gb, s->curr_bps);