Skip to content
Snippets Groups Projects
Commit 6eee9f55 authored by Nicolas George's avatar Nicolas George
Browse files

8svx: ensure that packet size is multiple of channels.

Fix an assert failure with packets of invalid size.
parent d1ebb25a
No related branches found
No related tags found
No related merge requests found
...@@ -112,9 +112,16 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, ...@@ -112,9 +112,16 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* decode and interleave the first packet */ /* decode and interleave the first packet */
if (!esc->samples && avpkt) { if (!esc->samples && avpkt) {
uint8_t *deinterleaved_samples, *p = NULL; uint8_t *deinterleaved_samples, *p = NULL;
int packet_size = avpkt->size;
if (packet_size % avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n");
if (packet_size < avctx->channels)
return packet_size;
packet_size -= packet_size % avctx->channels;
}
esc->samples_size = !esc->table ? esc->samples_size = !esc->table ?
avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2; packet_size : avctx->channels + (packet_size-avctx->channels) * 2;
if (!(esc->samples = av_malloc(esc->samples_size))) if (!(esc->samples = av_malloc(esc->samples_size)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment