WaveFile: Return GET_BUFFER_ERROR if wrong amount read

Closes: #2128
This commit is contained in:
jepler 2019-09-08 21:58:36 -05:00
parent ccf08aa3df
commit 82427612d1

View File

@ -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;