libtags: wav: do not div by zero (fixup)

This commit is contained in:
Sigrid Solveig Haflínudóttir 2022-03-30 20:54:11 +00:00
parent 2cdd31f8f4
commit cb4d441cb8

View file

@ -19,7 +19,7 @@ tagwav(Tagctx *ctx)
{
uchar *d;
int i, n, info;
u32int csz;
u32int csz, x;
uvlong sz;
d = (uchar*)ctx->buf;
@ -59,9 +59,10 @@ tagwav(Tagctx *ctx)
csz -= 16;
ctx->channels = le16u(d+2);
ctx->samplerate = leuint(d+4);
if(ctx->channels < 1 || ctx->samplerate < 1)
x = leuint(d+8);
if(ctx->channels < 1 || ctx->samplerate < 1 || x < 1)
return -1;
ctx->duration = sz*1000 / leuint(d+8);
ctx->duration = sz*1000 / x;
}else if(memcmp(d, "LIST", 4) == 0){
sz = csz - 4;
continue;