AK: Skip over initial empty chunks in DisjointChunks

This will be caught by new test cases: when the initial chunk is empty,
a dereference before calling operator++ on the iterator will crash as
the initial chunk's size is never checked.
This commit is contained in:
kleines Filmröllchen 2022-02-26 15:11:00 +01:00 committed by Ali Mohammad Pur
parent 4ec599aae5
commit 7e18e6e37b
Notes: sideshowbarker 2024-07-17 18:11:37 +09:00

View file

@ -24,6 +24,8 @@ struct DisjointIterator {
DisjointIterator(ReferenceType chunks)
: m_chunks(chunks)
{
while (m_chunk_index < m_chunks.size() && m_chunks[m_chunk_index].is_empty())
++m_chunk_index;
}
DisjointIterator(ReferenceType chunks, EndTag)