For reason unknown to me, ADS server reported two ADS symbols of the same name. And, adstool responded with an error "Corrupt nameLegth".
The behavior (of the adstool) is caused by an assumption that a name is unique in SymbolAccess::FetchSymbolEntries():
const auto next = entries.insert(bhf::ads::SymbolEntry::Parse(
data, bytesRead))
.first->second;
Since std::map::insert will insert a record only if its key is not in yet (https://en.cppreference.com/cpp/container/map/insert), this leaves the previously inserted symbol entry untouched. As a consequence, the routine moves data using the entry length of the previous inserted symbol entry resulting into a failure.
I would expect that FetchSymbolEntries() reports there is a duplicate and either pick one of them or fails. In either case, I would expect it to avoid using the entry length of a different record to access memory.
For reason unknown to me, ADS server reported two ADS symbols of the same name. And, adstool responded with an error "Corrupt nameLegth".
The behavior (of the adstool) is caused by an assumption that a name is unique in
SymbolAccess::FetchSymbolEntries():Since
std::map::insertwill insert a record only if its key is not in yet (https://en.cppreference.com/cpp/container/map/insert), this leaves the previously inserted symbol entry untouched. As a consequence, the routine movesdatausing the entry length of the previous inserted symbol entry resulting into a failure.I would expect that
FetchSymbolEntries()reports there is a duplicate and either pick one of them or fails. In either case, I would expect it to avoid using the entry length of a different record to access memory.