diff --git a/src/audio/wav_reader.c b/src/audio/wav_reader.c index 304820c83..3ae6718b6 100644 --- a/src/audio/wav_reader.c +++ b/src/audio/wav_reader.c @@ -195,8 +195,9 @@ static _Bool read_ds64(FILE *wav_file, uint32_t chunk_size, struct wav_metadata metadata->data_size = tmp; READ_N(&tmp, 8); // dummy - should be ignored uint32_t table_count = 0; - const int table_sz = (sizeof(uint32_t) /*ID*/ + sizeof(uint64_t) /*size*/); + const size_t table_sz = (sizeof(uint32_t) /*ID*/ + sizeof(uint64_t) /*size*/); READ_N(&table_count, 4); // number of table entries for non-'data' chunks + assert(table_sz * table_count <= MIN(sizeof(uint32_t), sizeof(long))); // check overflows if (chunk_size - 28 != table_sz * table_count) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "incorrect table count %" PRIu32 " given, ds64 chunk len %" PRIu32 "\n", table_count, chunk_size);