This needs fixing because I managed to trigger a segfault while writing a separate patch.
Details
Details
- Reviewers
Fabien - Group Reviewers
Restricted Project - Commits
- rABCca065adfaba3: [avalanche] Ensure nullptr safety on proccesor's public interface
ninja check-avalanche
Diff Detail
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- ava-prc-null-pindex
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 19086 Build 37920: Build Diff build-without-wallet · build-diff · lint-circular-dependencies · build-debug · build-clang · build-clang-tidy Build 37919: arc lint + arc unit
Event Timeline
src/avalanche/processor.cpp | ||
---|---|---|
323 ↗ | (On Diff #33528) | Please explain why this is needed: the CBlockIndexWorkComparator is dereferencing the pointer, which causes the find to segfault |
src/avalanche/processor.cpp | ||
---|---|---|
323 ↗ | (On Diff #33528) | We have two choices:
I chose to not go with option 1 because I did not want to touch validation code. However making that change would mean less worrying about it in multiple call sites here, so it may be worth revisiting. |
src/avalanche/processor.cpp | ||
---|---|---|
323 ↗ | (On Diff #33528) | I'm OK with the patch, I just want you to add a comment to explain that the nullptr dereference issue is from the comparator and not the map, so that someone reading this code won't remove the check by mistake, as it's not obvious from the code. |
src/avalanche/processor.cpp | ||
---|---|---|
291 | Here it's IsWorthPolling that needs the proof to be non null |