shithub: riscv

Download patch

ref: 2cdd31f8f4b6b4b24d13428378e225caa7aa8c70
parent: 7f2e62296514bacfb0ea7d5abf42dc8ccee1aedd
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Mar 30 16:51:03 EDT 2022

libtags: wav: do not div by zero

--- a/sys/src/cmd/audio/libtags/wav.c
+++ b/sys/src/cmd/audio/libtags/wav.c
@@ -59,6 +59,8 @@
 			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;