You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavf/matroskadec: Use av_realloc() in get_qt_codec()
Use av_realloc() rather than av_malloc() when normalizing noncompliant private data in get_qt_codec(). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
d64d6edfc7
commit
adef8ee794
@@ -1719,11 +1719,11 @@ static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *
|
|||||||
* by expanding/shifting the data by 4 bytes and storing the data
|
* by expanding/shifting the data by 4 bytes and storing the data
|
||||||
* size at the start. */
|
* size at the start. */
|
||||||
if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {
|
if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {
|
||||||
uint8_t *p = av_malloc(track->codec_priv.size + 4);
|
uint8_t *p = av_realloc(track->codec_priv.data,
|
||||||
|
track->codec_priv.size + 4);
|
||||||
if (!p)
|
if (!p)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
memcpy(p + 4, track->codec_priv.data, track->codec_priv.size);
|
memmove(p + 4, p, track->codec_priv.size);
|
||||||
av_free(track->codec_priv.data);
|
|
||||||
track->codec_priv.data = p;
|
track->codec_priv.data = p;
|
||||||
track->codec_priv.size += 4;
|
track->codec_priv.size += 4;
|
||||||
AV_WB32(track->codec_priv.data, track->codec_priv.size);
|
AV_WB32(track->codec_priv.data, track->codec_priv.size);
|
||||||
|
Reference in New Issue
Block a user