filecoin-project / cpp-filecoin

C++17 implementation of Filecoin
https://filecoin.io/
GNU General Public License v3.0
126 stars 36 forks source link

fix use after free in index_lock #546

Closed Alexey-N-Chernyshov closed 2 years ago

Alexey-N-Chernyshov commented 2 years ago

Signed-off-by: Alexey Chernyshov alexey.n.chernyshov@gmail.com

Description of the Change

Fix use after free in index lock. sectors.erase(lock.sector); deletes sector and then sector.cv is accessed and sector_lock still holds sector.mutex.

Benefits

Possible Drawbacks

Usage Examples or Tests [optional]

Alternate Designs [optional]

codecov[bot] commented 2 years ago

Codecov Report

Merging #546 (bb2eb21) into master (e59a5b3) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #546   +/-   ##
=======================================
  Coverage   46.38%   46.38%           
=======================================
  Files         680      680           
  Lines       30255    30256    +1     
  Branches    16759    16760    +1     
=======================================
+ Hits        14034    14035    +1     
  Misses      12182    12182           
  Partials     4039     4039           
Impacted Files Coverage Δ
core/sector_storage/stores/impl/index_lock.cpp 84.09% <100.00%> (+0.36%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e59a5b3...bb2eb21. Read the comment docs.