Skip to content

Commit

Permalink
Fix dereferencing of end iterator in PPMQ decompressor (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagamusix authored Jul 15, 2024
1 parent ab9704a commit 9929dc4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/PPMQDecompressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,15 @@ void PPMQDecompressor::decompressImpl(Buffer &rawData,const Buffer &previousData

void scale() noexcept
{

for (auto it=_nodes.begin();it!=_nodes.end();)
{
auto next=it++;
it->freq>>=1U;
if (!it->freq) _nodes.erase(it);
it=next;
if (!it->freq)
{
it = _nodes.erase(it);
} else {
it++;
}
}
}

Expand Down

0 comments on commit 9929dc4

Please sign in to comment.