marlin/buildroot
CaldurG 830009b890
🐛 Fix NULL pointer in SD sort without name caching (#28909)
With SDSORT_USES_RAM minus SDSORT_CACHE_NAMES and SDSORT_USES_STACK, the sortnames pointer is declared (as its declaration covers DISABLED(SDSORT_USES_STACK)) but the constructor only assigned it under ENABLED(SDSORT_CACHE_NAMES). presort() then writes through the NULL pointer via SET_SORTNAME, hard-faulting the board (e.g. LPC1768) as soon as an SD card with two or more files is mounted.

Assign sortnames whenever it is declared and not heap-allocated: whenever SDSORT_DYNAMIC_RAM is off and either SDSORT_CACHE_NAMES is on or SDSORT_USES_STACK is off. This also skips the wasted static allocation when SDSORT_DYNAMIC_RAM applies.

Add a build test (LPC1768/config-07) covering the crashing combo.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-26 01:43:35 -06:00
..
bin 🔨 Find active MOTHERBOARD for mfenvs (#28908) 2026-11-26 01:39:38 -06:00
etc/udev/rules.d 🔥 Not using .astylerc 2025-01-27 21:18:29 -06:00
share 🐛 Fix config-migrate.py endstop plugs, duplicate defines (#28912) 2026-11-25 21:42:26 -06:00
skills ✨ Compose files, skills for Mainsail / OctoPrint in Docker (#28759) 2026-10-28 18:26:15 -05:00
test-gcode M808 Repeat Markers (#20084) 2020-11-26 21:18:40 -06:00
tests 🐛 Fix NULL pointer in SD sort without name caching (#28909) 2026-11-26 01:43:35 -06:00
web-ui/data/www 📝 Update other dead links 2025-12-21 17:40:10 -06:00