Draft: Fix out-of-bounds read of spd_memory_type_name in DRAM detection

Summary

BackgroundDetectI2CDRAMDevices() indexes spd_memory_type_name[] (20 entries) with whatever byte SPDDetector::memory_type() returns. On systems without SPD EEPROMs — e.g. laptops with soldered LPDDR5X — a non-DIMM device answering at 0x50–0x57 can yield an arbitrary value, the lookup reads past the table and LOG_INFO crashes inside vsnprintf.

Observed as a sporadic SIGSEGV (about 1 in 10 starts, CLI and GUI alike) on an Acer Predator PH16-73:

#2  __vsnprintf
#3  LogManager::LogEntry_va
#4  LogManager::LogEntry
#5  DetectionManager::BackgroundDetectI2CDRAMDevices
#6  DetectionManager::BackgroundDetectDevices

This MR clamps the name lookup to the table and logs "Unknown" otherwise. 25/25 clean starts afterwards on the same machine (with I²C detection enabled).

Found while working on !3597.

Edited by Raya Elena Solano

Merge request reports

Loading
Loading