diff options
author | James Almer <jamrial@gmail.com> | 2023-06-15 11:35:22 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2023-06-17 10:08:54 -0300 |
commit | b1d0b59d81bc36e333572d36f878fc6735be63ad (patch) | |
tree | 8341f4207ca70ebf4e1b57458d40182d4146307e | |
parent | 9fc1d9adc8d05056ea53522c34ae4953ccdb7c59 (diff) | |
download | ffmpeg-b1d0b59d81bc36e333572d36f878fc6735be63ad.tar.gz |
avcodec/evc_frame_merge_bsf: check for av_memdup() failure
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r-- | libavcodec/evc_frame_merge_bsf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/evc_frame_merge_bsf.c b/libavcodec/evc_frame_merge_bsf.c index d2746a1ef6..fbb344490a 100644 --- a/libavcodec/evc_frame_merge_bsf.c +++ b/libavcodec/evc_frame_merge_bsf.c @@ -61,6 +61,7 @@ static void evc_frame_merge_flush(AVBSFContext *bsf) EVCFMergeContext *ctx = bsf->priv_data; av_packet_unref(ctx->in); + ctx->au_buffer.data_size = 0; } static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out) @@ -117,9 +118,13 @@ static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out) if (au_end_found) { uint8_t *data = av_memdup(ctx->au_buffer.data, ctx->au_buffer.data_size); - err = av_packet_from_data(out, data, ctx->au_buffer.data_size); + size_t data_size = ctx->au_buffer.data_size; ctx->au_buffer.data_size = 0; + if (!data) + return AVERROR(ENOMEM); + + err = av_packet_from_data(out, data, data_size); } else err = AVERROR(EAGAIN); |