Skip to content

raft: fix out-of-bounds in maybeAppend#13603

Merged
ptabor merged 1 commit intoetcd-io:mainfrom
AdamKorcz:fuzz3
Jan 17, 2022
Merged

raft: fix out-of-bounds in maybeAppend#13603
ptabor merged 1 commit intoetcd-io:mainfrom
AdamKorcz:fuzz3

Conversation

@AdamKorcz
Copy link
Copy Markdown
Contributor

Fixes an OOB in maybeAppend.

The fix is to throw a l.logger.Panicf in similar fashion as here and here.

OSS-fuzz issue: https://oss-fuzz.com/testcase-detail/6604212964818944

Copy link
Copy Markdown
Member

@spzala spzala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamKorcz thank you so much for the fix! Running the CI.

raft/log.go Outdated
l.logger.Panicf("entry %d conflict with committed entry [committed(%d)]", ci, l.committed)
default:
offset := index + 1
if ci-offset>uint64(len(ents)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting a space around > .. it may also fail static check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"gofmt -w filename" can format the source code automatically. But I wonder why the CI did not raise an error on this. We may need to enhance the CI. Just raised an issue to track this.

@AdamKorcz, could you please point me to the fuzz test case which discovers this issue? I am thinking it might not possible to see this issue in an e2e test case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamKorcz once you fix the space related static error, we should be good..some tests are flaky and not related to changes. Thanks!

@spzala
Copy link
Copy Markdown
Member

spzala commented Jan 15, 2022

cc @ptabor @serathius @ahrtr

@ptabor ptabor merged commit 22f142a into etcd-io:main Jan 17, 2022
@tbg tbg mentioned this pull request Oct 12, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants