From 201c97fdf8c36a34c765a24f375e9610bfcc3459 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 17 Feb 2019 16:41:37 +0100 Subject: [PATCH] Fixup 3 - remove small risk of crash if encode_setup called incorrectly --- src/transcode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transcode.c b/src/transcode.c index 74146f70..11831822 100644 --- a/src/transcode.c +++ b/src/transcode.c @@ -340,7 +340,8 @@ make_wav_header(struct encode_ctx *ctx, struct decode_ctx *src_ctx, off_t *est_s bps = av_get_bits_per_sample(ctx->settings.audio_codec); wav_len = ctx->settings.channels * (bps / 8) * ctx->settings.sample_rate * (duration / 1000); - *est_size = wav_len + sizeof(ctx->header); + if (est_size) + *est_size = wav_len + sizeof(ctx->header); memcpy(ctx->header, "RIFF", 4); add_le32(ctx->header + 4, 36 + wav_len);