Skip to content

Commit

Permalink
Fix crash when download bz2 from http
Browse files Browse the repository at this point in the history
Missed lock when reserve bigger buffer
Decompress thread will write to buffer, which already free

Signed-off-by: Frank Li <[email protected]>
  • Loading branch information
nxpfrankli committed Apr 26, 2022
1 parent 1dc59a1 commit 005ff6f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libuuu/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ int bz_async_load(string filename, shared_ptr<FileBuffer> p)
total += one.decompress_size;
if (total >= p->m_MemSize)
{
lock_guard<mutex> lock(p->m_data_mutex);
if (p->reserve(total*1.2))
return -1;
}
Expand Down

0 comments on commit 005ff6f

Please sign in to comment.