mirror of
https://github.com/wled/WLED.git
synced 2025-07-12 21:36:32 +00:00
better bugfix for seven-seg-reloaded
* only reject invalid ranges when array access will be actually performed * fixed another stupid pointer arithmetic error Hint: I AM NOT THE MAINTAINER of this usermod. I'm just fixing an obvious coding error without knowing what the usermod really does.
This commit is contained in:
parent
81cec6a25a
commit
340a9f8b76
@ -165,7 +165,7 @@ private:
|
|||||||
void _showElements(String *map, int timevar, bool isColon, bool removeZero
|
void _showElements(String *map, int timevar, bool isColon, bool removeZero
|
||||||
|
|
||||||
) {
|
) {
|
||||||
if (!(*map).equals("") && !(*map) == NULL) {
|
if ((map != nullptr) && (*map != nullptr) && !(*map).equals("")) {
|
||||||
int length = String(timevar).length();
|
int length = String(timevar).length();
|
||||||
bool addZero = false;
|
bool addZero = false;
|
||||||
if (length == 1) {
|
if (length == 1) {
|
||||||
@ -237,12 +237,12 @@ private:
|
|||||||
|
|
||||||
void _setLeds(int lednr, int lastSeenLedNr, bool range, int countSegments, int number, bool colon) {
|
void _setLeds(int lednr, int lastSeenLedNr, bool range, int countSegments, int number, bool colon) {
|
||||||
if ((lednr < 0) || (lednr >= umSSDRLength)) return; // prevent array bounds violation
|
if ((lednr < 0) || (lednr >= umSSDRLength)) return; // prevent array bounds violation
|
||||||
if ((number < 0) || (countSegments < 0) || (lastSeenLedNr <0)) return; // prevent array out of range access
|
|
||||||
|
|
||||||
|
if (!(colon && umSSDRColonblink) && ((number < 0) || (countSegments < 0))) return;
|
||||||
if ((colon && umSSDRColonblink) || umSSDRNumbers[number][countSegments]) {
|
if ((colon && umSSDRColonblink) || umSSDRNumbers[number][countSegments]) {
|
||||||
|
|
||||||
if (range) {
|
if (range) {
|
||||||
for(int i = lastSeenLedNr; i <= lednr; i++) {
|
for(int i = max(0, lastSeenLedNr); i <= lednr; i++) {
|
||||||
umSSDRMask[i] = true;
|
umSSDRMask[i] = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user