comparison ra144.c @ 6854:d4c8338a09a8 libavcodec

Handle the case where we do not have enough input
author vitor
date Sat, 24 May 2008 16:20:37 +0000
parents 84dc84916bab
children 128af7cac045
comparison
equal deleted inserted replaced
6853:9bfb69f1739e 6854:d4c8338a09a8
341 unsigned int val; 341 unsigned int val;
342 342
343 Real144_internal *glob = avctx->priv_data; 343 Real144_internal *glob = avctx->priv_data;
344 GetBitContext gb; 344 GetBitContext gb;
345 345
346 if(buf_size == 0) 346 if(buf_size < 20) {
347 return 0; 347 av_log(avctx, AV_LOG_ERROR,
348 348 "Frame too small (%d bytes). Truncated file?\n", buf_size);
349 return buf_size;
350 }
349 init_get_bits(&gb, buf, 20 * 8); 351 init_get_bits(&gb, buf, 20 * 8);
350 352
351 for (i=0; i<10; i++) 353 for (i=0; i<10; i++)
352 // "<< 1"? Doesn't this make one value out of two of the table useless? 354 // "<< 1"? Doesn't this make one value out of two of the table useless?
353 glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1]; 355 glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1];