Unverified Commit f5b25a86 authored by Wolle's avatar Wolle Committed by GitHub

guard impl. for invalid audioheader

parent 6dc1f001
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Audio.cpp * Audio.cpp
* *
* Created on: Oct 26,2018 * Created on: Oct 26,2018
* Updated on: Feb 04,2022 * Updated on: Feb 05,2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
* *
*/ */
...@@ -1830,7 +1830,7 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) { ...@@ -1830,7 +1830,7 @@ int Audio::read_M4A_Header(uint8_t *data, size_t len) {
if(m_controlCounter == M4A_AMRDY){ // almost ready if(m_controlCounter == M4A_AMRDY){ // almost ready
m_audioDataStart = headerSize; m_audioDataStart = headerSize;
m_contentlength = headerSize + m_audioDataSize; // after this mdat atom there may be other atoms m_contentlength = headerSize + m_audioDataSize; // after this mdat atom there may be other atoms
log_i("begin mdat %i", headerSize); // log_i("begin mdat %i", headerSize);
if(m_f_localfile){ if(m_f_localfile){
AUDIO_INFO(sprintf(chbuf, "Content-Length: %u", m_contentlength);) AUDIO_INFO(sprintf(chbuf, "Content-Length: %u", m_contentlength);)
} }
...@@ -2849,6 +2849,10 @@ void Audio::processLocalFile() { ...@@ -2849,6 +2849,10 @@ void Audio::processLocalFile() {
m_controlCounter = 100; m_controlCounter = 100;
} }
} }
if(!isRunning()){
log_e("Processing stopped due to invalid audio header");
return;
}
} }
else { else {
bytesDecoded = sendBytes(InBuff.getReadPtr(), bytesCanBeRead); bytesDecoded = sendBytes(InBuff.getReadPtr(), bytesCanBeRead);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
//#define SDFATFS_USED // activate for SdFat //#define SDFATFS_USED // activate for SdFat
#pragma once #pragma once
#pragma GCC optimize ("Ofast") #pragma GCC optimize ("Ofast")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment