PaulStoffregen / Audio

Teensy Audio Library
http://www.pjrc.com/teensy/td_libs_Audio.html
1.08k stars 401 forks source link

Result from wavfile.read() not checked in play_sd_wav.cpp #411

Open StephanLuik opened 2 years ago

StephanLuik commented 2 years ago

Description

In the void AudioPlaySdWav::update(void) method, the result of the file read() operation wavfile.read() is not checked for -1 status, indicating a read error. The buffer_length variable is declared as unsigned, while it should be a signed variable.

Steps To Reproduce Problem

I came across this error when reading from an SDcard while some other SPI device was messing up the SPI data communications.

Hardware & Software

Teensy 4.1 with pins Audio Adaptor rev. D Arduino version 1.8.13 Teensyduino version 1.53 Windows 10 Pro 21H1

Arduino Sketch

Errors or Incorrect Output