diff --git a/src/wav.c b/src/wav.c index 63d8aeb..29cf849 100644 --- a/src/wav.c +++ b/src/wav.c @@ -38,7 +38,8 @@ int wav_read(const char *path, float **buffer, unsigned *frames) { if (read_uint16(fd, &num_channels) != 0) { close(fd); return -1; } if (read_uint32(fd, &sample_rate) != 0) { close(fd); return -1; } if (read_uint16(fd, &bits_per_sample) != 0){ close(fd); return -1; } - if (fmt_size > 16) lseek(fd, fmt_size - 16, SEEK_CUR); + unsigned consumed = 2 + 2 + 4 + 2; /* format, channels, sample_rate, bits_per_sample */ + if (fmt_size > consumed) lseek(fd, fmt_size - consumed, SEEK_CUR); continue; } if (memcmp(sub_id, "data", 4) == 0) break;