Skip to content

fix: add bounds check for current_idx in AE response handler#127

Open
Qian-Cheng-nju wants to merge 3 commits intowillemt:masterfrom
specula-org:fix/ae-response-bounds-check
Open

fix: add bounds check for current_idx in AE response handler#127
Qian-Cheng-nju wants to merge 3 commits intowillemt:masterfrom
specula-org:fix/ae-response-bounds-check

Conversation

@Qian-Cheng-nju
Copy link
Copy Markdown

@Qian-Cheng-nju Qian-Cheng-nju commented Mar 25, 2026

Hi!

I found a crash in the AppendEntries response handler and put together a fix.

When a peer sends an AE response with current_idx larger than the leader's log length, raft_get_entry_from_idx returns NULL and the code dereferences it (ety->term), crashing the process. The existing assert at line 366 catches this in debug builds, but it's compiled out in release.

The fix adds a proper bounds check so out-of-range current_idx is handled gracefully instead of crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant