|
// add/remove custom/audioreactive palettes |
|
if (prevEnabled && !enabled) removeAudioPalettes(); |
|
if (!prevEnabled && enabled) createAudioPalettes(); |
When the AR usermod is "switched off" (button in info panel, or by unchecking "enabled" in AR settings). audioreactive palettes are erased from the internal palettes vector. If a preset still references an Effect with AR palette, accessing the palette colors reads from unallocated memory - vector array [] access is not checked for bounds violation.
This is inconsistent to other AR effects, which enable Sound Simulation when the AR usermod is off. Its also inconsistent with the original AR palettes behaviour in WLED-MM, where palette colors come from simulation (fftResult[]) when AR is disabled.
|
usermodPalettes.erase(usermodPalettes.begin() + i); |
|
} else if (i >= palettesCount) { // usermod palettes (IDs 255, 254, ...) |
|
int umIdx = i - palettesCount; |
|
setPaletteColors(curPalette, usermodPalettes[umIdx].palette); |
|
default: //progmem palettes |
|
if (pal > WLED_CUSTOM_PALETTE_ID_BASE) { // usermod palette |
|
targetPalette = usermodPalettes[WLED_USERMOD_PALETTE_ID_BASE - pal].palette; |
WLED/usermods/audioreactive/audio_reactive.cpp
Lines 1958 to 1960 in 4efb02d
When the AR usermod is "switched off" (button in info panel, or by unchecking "enabled" in AR settings). audioreactive palettes are erased from the internal palettes vector. If a preset still references an Effect with AR palette, accessing the palette colors reads from unallocated memory - vector array [] access is not checked for bounds violation.
This is inconsistent to other AR effects, which enable Sound Simulation when the AR usermod is off. Its also inconsistent with the original AR palettes behaviour in WLED-MM, where palette colors come from simulation (fftResult[]) when AR is disabled.
WLED/wled00/colors.cpp
Line 319 in 4efb02d
WLED/wled00/json.cpp
Lines 1014 to 1016 in 4efb02d
WLED/wled00/FX_fcn.cpp
Lines 276 to 278 in 4efb02d