Commit dcd207c4 authored by Nicolas George's avatar Nicolas George

matroskadec: use av_grow_packet in merge_packets.

It ensures that the packet is properly padded
and makes the code simpler.

Fixes trac ticket #1223.
parent 1a65d50e
...@@ -1126,12 +1126,10 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, ...@@ -1126,12 +1126,10 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
static int matroska_merge_packets(AVPacket *out, AVPacket *in) static int matroska_merge_packets(AVPacket *out, AVPacket *in)
{ {
void *newdata = av_realloc(out->data, out->size+in->size); int ret = av_grow_packet(out, in->size);
if (!newdata) if (ret < 0)
return AVERROR(ENOMEM); return ret;
out->data = newdata; memcpy(out->data + out->size - in->size, in->data, in->size);
memcpy(out->data+out->size, in->data, in->size);
out->size += in->size;
av_destruct_packet(in); av_destruct_packet(in);
av_free(in); av_free(in);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment