Hi! The output of truehd_core is currently undeterministic, the last bytes are uninitialized, valgrind protests if less than 8 bytes are initialized. I believe attached patch is simpler than calculating the necessary write size at the bottom of the function.
Please comment, Carl Eugen
From e824c88cc15446cc0e3f80672a38f8503333b3a7 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos <ceffm...@gmail.com> Date: Tue, 12 Feb 2019 12:54:31 +0100 Subject: [PATCH] lavc/truehd_core: Initialize the last bytes of the output buffer. Avoids undeterministic output. --- libavcodec/truehd_core_bsf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c index be021af..a78eedc 100644 --- a/libavcodec/truehd_core_bsf.c +++ b/libavcodec/truehd_core_bsf.c @@ -117,6 +117,8 @@ static int truehd_core_filter(AVBSFContext *ctx, AVPacket *out) out->size -= reduce * 2; parity_nibble ^= out->size / 2; + if (out_size > 8) + memset(out->data + out_size - 8, 0, 8); if (have_header) { memcpy(out->data + 4, in->data + 4, 28); out->data[16 + 4] = (out->data[16 + 4] & 0x0f) | (FFMIN(s->hdr.num_substreams, 3) << 4); -- 1.7.10.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel