Unified · Split
| @@ -18,7 +18,9 @@ int · 17 unmodified lines | |||
| 18 | tagwav(Tagctx *ctx) | 18 | tagwav(Tagctx *ctx) |
| 19 | { | 19 | { |
| 20 | uchar *d; | 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 | d = (uchar*)ctx->buf; | 25 | d = (uchar*)ctx->buf; |
| 24 | 26 | ||
| @@ -57,7 +59,10 @@ tagwav(Tagctx *ctx) · 32 unmodified lines | |||
| 57 | csz -= 16; | 59 | csz -= 16; |
| 58 | ctx->channels = le16u(d+2); | 60 | ctx->channels = le16u(d+2); |
| 59 | ctx->samplerate = leuint(d+4); | 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 | }else if(memcmp(d, "LIST", 4) == 0){ | 66 | }else if(memcmp(d, "LIST", 4) == 0){ |
| 62 | sz = csz - 4; | 67 | sz = csz - 4; |
| 63 | continue; | 68 | continue; |
| @@ -67,7 +72,7 @@ tagwav(Tagctx *ctx) · 3 unmodified lines | |||
| 67 | csz++; | 72 | csz++; |
| 68 | for(n = 0; n < nelem(t); n++){ | 73 | for(n = 0; n < nelem(t); n++){ |
| 69 | if(memcmp(d, t[n].s, 4) == 0){ | 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 | return -1; | 76 | return -1; |
| 72 | d[csz-1] = 0; | 77 | d[csz-1] = 0; |
| 73 | txtcb(ctx, t[n].type, "", d); | 78 | txtcb(ctx, t[n].type, "", d); |