Skip to content

Commit

Permalink
Fix a nullptr access after trying to replay an invalid filename (biol…
Browse files Browse the repository at this point in the history
…ogist79#271), thanks to Olaf!

WebUI: Show playtime for webstream
  • Loading branch information
tueddy committed Nov 30, 2023
1 parent 8a3314c commit 29bf165
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## DEV-branch

* 30.11.2023: Fix a nullptr access after trying to replay an invalid filename (#271), thanks to Olaf!
* 29.11.2023: Updated audio library to play more MP3s, faster track change & delivery of the cover image
* 25.11.2023: Save some cpu time in audio task by only updating the playtime statistics every 250ms
* 22.11.2023: Web-UI: Search for files feature #268
Expand Down
6 changes: 5 additions & 1 deletion html/management.html
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,11 @@ <h5 class="modal-title" data-i18n="tools.nvserase.title"></h5>
if (msg.duration > 0) {
document.getElementById('playtime').innerHTML = secondsToTime(msg.time) + " / " + secondsToTime(msg.duration);
} else {
document.getElementById('playtime').innerHTML = "-- / --";
if (msg.time > 0) {
document.getElementById('playtime').innerHTML = secondsToTime(msg.time);
} else {
document.getElementById('playtime').innerHTML = "-- / --";
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/SdCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ char **SdCard_ReturnPlaylist(const char *fileName, const uint32_t _playMode) {
if (files != NULL) { // If **ptr already exists, de-allocate its memory
Log_Printf(LOGLEVEL_DEBUG, releaseMemoryOfOldPlaylist, ESP.getFreeHeap());
freeMultiCharArray(files, strtoul(files[0], NULL, 10) + 1);
files = nullptr;
Log_Printf(LOGLEVEL_DEBUG, freeMemoryAfterFree, ESP.getFreeHeap());
}

Expand Down Expand Up @@ -402,6 +403,7 @@ char **SdCard_ReturnPlaylist(const char *fileName, const uint32_t _playMode) {
Log_Println(unableToAllocateMemForPlaylist, LOGLEVEL_ERROR);
System_IndicateError();
freeMultiCharArray(files, cnt + 1);
files = nullptr;
return nullptr;
}
snprintf(files[0], 5, "%u", cnt);
Expand Down
2 changes: 1 addition & 1 deletion src/revision.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "gitrevision.h"
constexpr const char softwareRevision[] = "Software-revision: 20231129-1-DEV";
constexpr const char softwareRevision[] = "Software-revision: 20231130-1-DEV";

0 comments on commit 29bf165

Please sign in to comment.