From 2cdd31f8f4b6b4b24d13428378e225caa7aa8c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Wed, 30 Mar 2022 20:51:03 +0000 Subject: [PATCH] libtags: wav: do not div by zero --- sys/src/cmd/audio/libtags/wav.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/src/cmd/audio/libtags/wav.c b/sys/src/cmd/audio/libtags/wav.c index a016a1224..4b284faeb 100644 --- a/sys/src/cmd/audio/libtags/wav.c +++ b/sys/src/cmd/audio/libtags/wav.c @@ -59,6 +59,8 @@ tagwav(Tagctx *ctx) csz -= 16; ctx->channels = le16u(d+2); ctx->samplerate = leuint(d+4); + if(ctx->channels < 1 || ctx->samplerate < 1) + return -1; ctx->duration = sz*1000 / leuint(d+8); }else if(memcmp(d, "LIST", 4) == 0){ sz = csz - 4;