comparison alac.c @ 7660:6fe7ff34a4db libavcodec

alac : check readsamplesize to ensure get_bits() doesn't fail. Patch by Matthieu Castet <castet.matthieu AT free fr>
author jai_menon
date Fri, 22 Aug 2008 15:09:20 +0000
parents 85ab7655ad4d
children 4525dcd81357
comparison
equal deleted inserted replaced
7659:b87a9296e854 7660:6fe7ff34a4db
409 ALACContext *alac = avctx->priv_data; 409 ALACContext *alac = avctx->priv_data;
410 410
411 int channels; 411 int channels;
412 unsigned int outputsamples; 412 unsigned int outputsamples;
413 int hassize; 413 int hassize;
414 int readsamplesize; 414 unsigned int readsamplesize;
415 int wasted_bytes; 415 int wasted_bytes;
416 int isnotcompressed; 416 int isnotcompressed;
417 uint8_t interlacing_shift; 417 uint8_t interlacing_shift;
418 uint8_t interlacing_leftweight; 418 uint8_t interlacing_leftweight;
419 419
474 return -1; 474 return -1;
475 } 475 }
476 476
477 *outputsize = outputsamples * alac->bytespersample; 477 *outputsize = outputsamples * alac->bytespersample;
478 readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1; 478 readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1;
479 if (readsamplesize > MIN_CACHE_BITS) {
480 av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
481 return -1;
482 }
479 483
480 if (!isnotcompressed) { 484 if (!isnotcompressed) {
481 /* so it is compressed */ 485 /* so it is compressed */
482 int16_t predictor_coef_table[channels][32]; 486 int16_t predictor_coef_table[channels][32];
483 int predictor_coef_num[channels]; 487 int predictor_coef_num[channels];