Commit a9959fe
Closes
https://dashboard.hackenproof.com/manager/companies/celestia/celestia/reports/CELESTIA-239
## Summary
- A connected P2P peer could crash any non-state-syncing node (the
default operating mode) by sending a single `SnapshotsResponse` with
`Chunks > MaxSnapshotChunks`. The `validateMsg` error path in
`Reactor.Receive` called `r.syncer.RejectPeer()` before checking whether
`r.syncer` was nil, causing an unrecovered panic that terminates the
node process.
- Added a nil guard with mutex protection around the `RejectPeer` call
so oversized snapshot messages are safely rejected when no state sync is
active.
- Added a regression test that confirms the panic without the fix and
passes with it.
## Test plan
- [x] New test `TestReactor_Receive_OversizedSnapshotResponse_NilSyncer`
verifies no panic when `r.syncer` is nil and an oversized
`SnapshotsResponse` is received
- [x] Full `./statesync/...` test suite passes
- [x] `go vet ./statesync/...` clean
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
<a
href="https://app.devin.ai/review/celestiaorg/celestia-core/pull/2883"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<hr>This is an automatic backport of pull request #2883 done by
[Mergify](https://mergify.com).
<!-- devin-review-badge-begin -->
---
<a
href="https://app.devin.ai/review/celestiaorg/celestia-core/pull/2931"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
Co-authored-by: Rootul P <rootulp@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aaf484d commit a9959fe
3 files changed
Lines changed: 64 additions & 1 deletion
File tree
- .changelog/unreleased/bug-fixes
- statesync
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
99 | 155 | | |
100 | 156 | | |
101 | 157 | | |
| |||
0 commit comments