From 43abb18e4ec31a8b7b92c64aa68c28421195454c Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 20 Aug 2017 23:08:36 +0200 Subject: [PATCH] [transcode] Fix illegal write when *icy_timer is null (fixes issue #412) --- src/transcode_legacy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/transcode_legacy.c b/src/transcode_legacy.c index 104a5a19..ef2a0b32 100644 --- a/src/transcode_legacy.c +++ b/src/transcode_legacy.c @@ -1490,7 +1490,8 @@ transcode(struct evbuffer *evbuf, int *icy_timer, struct transcode_ctx *ctx, int int processed; int ret; - *icy_timer = 0; + if (icy_timer) + *icy_timer = 0; processed = 0; while (processed < want_bytes) @@ -1508,7 +1509,7 @@ transcode(struct evbuffer *evbuf, int *icy_timer, struct transcode_ctx *ctx, int } ctx->encode_ctx->total_bytes += processed; - if (ctx->encode_ctx->icy_interval) + if (icy_timer && ctx->encode_ctx->icy_interval) *icy_timer = (ctx->encode_ctx->total_bytes % ctx->encode_ctx->icy_interval < processed); return processed;