- bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE);
- c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2);
- init_get_bits(&gb, bits, (buf_size - 4)* 8);
- skip_bits_long(&gb, buf[0]);
+ av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size);
+ if (!c->bits)
+ return AVERROR(ENOMEM);
+ c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf,
+ buf_size >> 2);
+ init_get_bits(&gb, c->bits, buf_size * 8);
+ skip_bits_long(&gb, skip);