Skip to content

Commit

Permalink
Fix dereferencing of end iterator in PPMQ decompressor
Browse files Browse the repository at this point in the history
  • Loading branch information
sagamusix committed Jul 15, 2024
1 parent ab9704a commit b34989f
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 b34989f

Please sign in to comment.