mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 21:11:53 +01:00
Correct IntervalMap
insertion end
calculation
The `end` pointer for `interval` was incorrectly calculated as `interval.data() + interval.size_bytes()` which would be incorrect when the interval span type is not `u8` as the pointer derived from `interval.data()` would be a pointer to the span type rather than a byte pointer and be subject to arithmetic of that object's size rather than in terms of a byte.
This commit is contained in:
parent
b0910e7b1a
commit
a6599c30b4
@ -51,7 +51,7 @@ namespace skyline {
|
||||
EntryGroup(span<span<T>> lIntervals, EntryType value) : value(std::move(value)) {
|
||||
intervals.reserve(lIntervals.size());
|
||||
for (const auto &interval : lIntervals)
|
||||
intervals.emplace_back(interval.data(), interval.data() + interval.size_bytes());
|
||||
intervals.emplace_back(interval.data(), interval.data() + interval.size());
|
||||
}
|
||||
};
|
||||
|
||||
@ -115,7 +115,7 @@ namespace skyline {
|
||||
GroupHandle Insert(span<span<T>> intervals, EntryType value) requires std::is_pointer_v<AddressType> {
|
||||
GroupHandle group{groups.emplace(groups.begin(), intervals, std::move(value))};
|
||||
for (const auto &interval : intervals)
|
||||
entries.emplace(std::lower_bound(entries.begin(), entries.end(), interval.data()), interval.data(), interval.data() + interval.size_bytes(), group);
|
||||
entries.emplace(std::lower_bound(entries.begin(), entries.end(), interval.data()), interval.data(), interval.data() + interval.size(), group);
|
||||
return group;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user