From 5b45a79cf7997d918aa7f9aa3ee3e619d287f074 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 15 Dec 2017 22:31:36 -0800 Subject: [PATCH] Fix ICY decoder overflow causing streams to die --- README.md | 2 ++ examples/WebRadio/WebRadio.ino | 2 +- src/AudioFileSourceICYStream.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f84245c..9041180 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ git clone https://github.com/earlephilhower/ESP8266Audio git clone https://github.com/earlephilhower/ESP8266_Spiram # Once the pull request is merged, replace above with "git clone https://github.com/Gianbacchio/ESP8266_Spiram" ```` +Alternatively, install using the Arduino Boards manager by using the following URL and selecting 2.4.0-rc2: +https://github.com/esp8266/Arduino/releases/download/2.4.0-rc2/package_esp8266com_index.json When in the IDE please select the following options: ```` diff --git a/examples/WebRadio/WebRadio.ino b/examples/WebRadio/WebRadio.ino index 94fb649..f05ca1b 100644 --- a/examples/WebRadio/WebRadio.ino +++ b/examples/WebRadio/WebRadio.ino @@ -104,7 +104,7 @@ Change URL: void HandleIndex(WiFiClient *client) { - char buff[sizeof(BODY) + 64*3 + 3*2]; + char buff[sizeof(BODY) + sizeof(title) + sizeof(status) + sizeof(url) + 3*2]; Serial.printf_P(PSTR("Sending INDEX...Free mem=%d\n"), ESP.getFreeHeap()); WebHeaders(client, NULL); diff --git a/src/AudioFileSourceICYStream.cpp b/src/AudioFileSourceICYStream.cpp index 9fcd45c..38212e9 100644 --- a/src/AudioFileSourceICYStream.cpp +++ b/src/AudioFileSourceICYStream.cpp @@ -77,7 +77,7 @@ class ICYMDReader { ~ICYMDReader() { // Get rid of any remaining bytes in the MD block char xxx[16]; - if (saved) avail--; // Throw away any unread bytes + if (saved>=0) avail--; // Throw away any unread bytes while (avail > 16) { stream->readBytes(xxx, 16); avail -= 16;