Unified · Split
| @@ -18,7 +18,9 @@ int · 17 unmodified lines | ||
| 18 | 18 | tagwav(Tagctx *ctx) |
| 19 | 19 | { |
| 20 | 20 | uchar *d; |
| 21 | − int i, n, info, csz, sz; | |
| 21 | + int i, n, info; | |
| 22 | + u32int csz, x; | |
| 23 | + uvlong sz; | |
| 22 | 24 | |
| 23 | 25 | d = (uchar*)ctx->buf; |
| 24 | 26 | |
| @@ -57,7 +59,10 @@ tagwav(Tagctx *ctx) · 32 unmodified lines | ||
| 57 | 59 | csz -= 16; |
| 58 | 60 | ctx->channels = le16u(d+2); |
| 59 | 61 | ctx->samplerate = leuint(d+4); |
| 60 | − ctx->duration = sz*1000 / leuint(d+8); | |
| 62 | + x = leuint(d+8); | |
| 63 | + if(ctx->channels < 1 || ctx->samplerate < 1 || x < 1) | |
| 64 | + return -1; | |
| 65 | + ctx->duration = sz*1000 / x; | |
| 61 | 66 | }else if(memcmp(d, "LIST", 4) == 0){ |
| 62 | 67 | sz = csz - 4; |
| 63 | 68 | continue; |
| @@ -67,7 +72,7 @@ tagwav(Tagctx *ctx) · 3 unmodified lines | ||
| 67 | 72 | csz++; |
| 68 | 73 | for(n = 0; n < nelem(t); n++){ |
| 69 | 74 | if(memcmp(d, t[n].s, 4) == 0){ |
| 70 | − if(ctx->read(ctx, d, csz) != csz) | |
| 75 | + if(ctx->read(ctx, d, csz) != (int)csz) | |
| 71 | 76 | return -1; |
| 72 | 77 | d[csz-1] = 0; |
| 73 | 78 | txtcb(ctx, t[n].type, "", d); |