WaveFile: Return GET_BUFFER_ERROR if wrong amount read

Closes: #2128
crypto-aes
jepler 3 years ago
parent ccf08aa3df
commit 82427612d1

@ -216,7 +216,7 @@ audioio_get_buffer_result_t audioio_wavefile_get_buffer(audioio_wavefile_obj_t*
} else {
*buffer = self->buffer;
}
if (f_read(&self->file->fp, *buffer, num_bytes_to_load, &length_read) != FR_OK) {
if (f_read(&self->file->fp, *buffer, num_bytes_to_load, &length_read) != FR_OK || length_read != num_bytes_to_load) {
return GET_BUFFER_ERROR;
}
self->bytes_remaining -= length_read;

Loading…
Cancel
Save