[transcode] Fix illegal write when *icy_timer is null (fixes issue #412)

This commit is contained in:
ejurgensen 2017-08-20 23:08:36 +02:00
parent 2d3d641f41
commit 43abb18e4e

View File

@ -1490,6 +1490,7 @@ transcode(struct evbuffer *evbuf, int *icy_timer, struct transcode_ctx *ctx, int
int processed; int processed;
int ret; int ret;
if (icy_timer)
*icy_timer = 0; *icy_timer = 0;
processed = 0; processed = 0;
@ -1508,7 +1509,7 @@ transcode(struct evbuffer *evbuf, int *icy_timer, struct transcode_ctx *ctx, int
} }
ctx->encode_ctx->total_bytes += processed; 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); *icy_timer = (ctx->encode_ctx->total_bytes % ctx->encode_ctx->icy_interval < processed);
return processed; return processed;