- avctx->channels = s->channels = get_le16(&s->gb);
- avctx->bits_per_sample = get_le16(&s->gb);
- s->bps = (avctx->bits_per_sample + 7) / 8;
- avctx->sample_rate = get_le32(&s->gb);
- s->data_length = get_le32(&s->gb);
+ avctx->channels = s->channels = get_bits(&s->gb, 16);
+ avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
+ s->bps = (avctx->bits_per_coded_sample + 7) / 8;
+ avctx->sample_rate = get_bits_long(&s->gb, 32);
+ if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check
+ av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
+ return -1;
+ }
+ s->data_length = get_bits_long(&s->gb, 32);