Commit a88a3cdb authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

dump_extradata: Insert extradata even for small packets

3469cfab added a check for whether the extradata coincided with the
beginning of the packet's data in order not to add extradata to packets
that already have it. But the check used was buggy for packets whose
size is smaller than the extradata's size. This commit fixes this.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4a141f8e
...@@ -51,8 +51,8 @@ static int dump_extradata(AVBSFContext *ctx, AVPacket *out) ...@@ -51,8 +51,8 @@ static int dump_extradata(AVBSFContext *ctx, AVPacket *out)
if (ctx->par_in->extradata && if (ctx->par_in->extradata &&
(s->freq == DUMP_FREQ_ALL || (s->freq == DUMP_FREQ_ALL ||
(s->freq == DUMP_FREQ_KEYFRAME && in->flags & AV_PKT_FLAG_KEY)) && (s->freq == DUMP_FREQ_KEYFRAME && in->flags & AV_PKT_FLAG_KEY)) &&
in->size >= ctx->par_in->extradata_size && (in->size < ctx->par_in->extradata_size ||
memcmp(in->data, ctx->par_in->extradata, ctx->par_in->extradata_size)) { memcmp(in->data, ctx->par_in->extradata, ctx->par_in->extradata_size))) {
if (in->size >= INT_MAX - ctx->par_in->extradata_size) { if (in->size >= INT_MAX - ctx->par_in->extradata_size) {
ret = AVERROR(ERANGE); ret = AVERROR(ERANGE);
goto fail; goto fail;
......
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