From 213854249dc8d69653a9f3281cdd4c2063cd3779 Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Wed, 10 Aug 2022 13:53:17 -0500 Subject: [PATCH] copy_input_buffer: only copy metadata if a frame was actaully sent Fixes a segfault if EOS was send through the library without zeroing out the metadata array Signed-off-by: Christopher Degawa --- Source/Lib/Encoder/Globals/EbEncHandle.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Lib/Encoder/Globals/EbEncHandle.c b/Source/Lib/Encoder/Globals/EbEncHandle.c index ba5e719a4..fc7a2b1f4 100644 --- a/Source/Lib/Encoder/Globals/EbEncHandle.c +++ b/Source/Lib/Encoder/Globals/EbEncHandle.c @@ -4814,11 +4814,12 @@ static void copy_input_buffer(SequenceControlSet* scs, EbBufferHeaderType* dst, } else if (pass != ENCODE_FIRST_PASS || copy_frame) { // Bypass copy for the unecessary picture in IPPP pass // Copy the picture buffer - if (src->p_buffer != NULL) + if (src->p_buffer != NULL) { copy_frame_buffer(scs, dst->p_buffer, dst_y8b->p_buffer, src->p_buffer, pass); - // Copy the metadata array - if (svt_aom_copy_metadata_buffer(dst, src->metadata) != EB_ErrorNone) - dst->metadata = NULL; + // Copy the metadata array + if (svt_aom_copy_metadata_buffer(dst, src->metadata) != EB_ErrorNone) + dst->metadata = NULL; + } } // Copy the private data list -- GitLab