Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PagedEntityContainer: fix
advance_page_index()
for expired pages
This prevents accessing invalid indices when an iterator is already pointing within an expired page. This may happen, for example, in the following case: 1. Get an iterator into page `P`, which has one valid element anywhere except the last valid index. 2. Call `erase(it)` for the parent container. 3. Invoke `++it`. So, previously, the iterator won't notice that the page has expired after `erase(it)` and will try to just increase the infra-index inside page `P`, although this will cause access to already released memory (because, pages release their storage upon expiration). Fix that by always checking for page expiration first in the `advance_page_index()`. Signed-off-by: Pavel Solodovnikov <[email protected]>
- Loading branch information