Home
last modified time | relevance | path

Searched hist:"7 dd6443b" (Results 1 – 1 of 1) sorted by relevance

/openbmc/dbus-sensors/src/
H A DHwmonTempMain.cpp7dd6443b Wed Mar 30 16:28:33 CDT 2022 Jae Hyun Yoo <quic_jaehyoo@quicinc.com> HwmonTempSensor: Fix a crash when an I3C device is scanned

When an I3C device is registered in hwmon sub-system, the device would have
a long address tag such as '0-4cc31020000', so if the scanning loop uses
'stoi' for the address parsing, this service crashs by this error.

terminate called after throwing an instance of 'std::out_of_range'
what(): stoi
Aborted (core dumped)

To prevent this issue, this commit replaces 'stoi' with std::from_chars
to uint64_t type since BasicVariantType can be up to uint64_t and it
actually parses unsigned numbers from Bus and Address settings.

Tested: HwmonTempSensor service didn't crash even when an I3C device is
enumerated in sysfs.

Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Change-Id: I5a06849b4149d535b2d4002f0f6e1e7bd5f94b97