Skip to content

Probable bug. Endless recursion in CompositeByteBuf#8758

Closed
doom369 wants to merge 1 commit intonetty:masterfrom
doom369:recursion
Closed

Probable bug. Endless recursion in CompositeByteBuf#8758
doom369 wants to merge 1 commit intonetty:masterfrom
doom369:recursion

Conversation

@doom369
Copy link
Copy Markdown
Contributor

@doom369 doom369 commented Jan 22, 2019

Motivation:

During review found strange code:

    public int toComponentIndex(int offset) {
        checkIndex(offset);
        return toComponentIndex(offset);
    }

Seems like it was a typo and code should be

    public int toComponentIndex(int offset) {
        checkIndex(offset);
        return toComponentIndex0(offset);
    }

Introduced with #8437. FYI @njhill

@netty-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@normanmaurer
Copy link
Copy Markdown
Member

normanmaurer commented Jan 22, 2019

@doom369 You may be right... @njhill mind reviewing

@normanmaurer
Copy link
Copy Markdown
Member

@doom369 can you also include a unit test ?

Copy link
Copy Markdown
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Errg, that's a nasty one.... thanks @doom369. Agree with @normanmaurer that we should have a unit test, if you don't want to add that I'd be happy to given it's my bug!

@doom369
Copy link
Copy Markdown
Contributor Author

doom369 commented Jan 23, 2019

@njhill please do, you can submit fix + test in another PR. I'm not aware of this codebase, so it will take some time for me.

njhill added a commit to njhill/netty that referenced this pull request Jan 23, 2019
Motivation

In netty#8758, @doom369 reported an infinite loop bug in CompositeByteBuf
which was introduced in netty#8437.

This is the same small fix for that, along with fixes for two other bugs
found while re-inspecting the changes and adding unit tests.

Modification

- Replace recursive call to toComponentIndex with toComponentIndex0 as
intended
- Add missed "lastAccessed" racy cache invalidation in capacity(int)
method
- Fix incorrect determination of initial offset in non-zero cIndex case
of updateComponentOffsets method
- New unit tests for previously uncovered methods

Results

Fewer bugs.
@njhill
Copy link
Copy Markdown
Member

njhill commented Jan 23, 2019

@normanmaurer @doom369 see #8773. Thanks again and sorry for the bugs!

@normanmaurer
Copy link
Copy Markdown
Member

Will be fixed by #8773

normanmaurer pushed a commit that referenced this pull request Jan 24, 2019
Motivation

In #8758, @doom369 reported an infinite loop bug in CompositeByteBuf
which was introduced in #8437.

This is the same small fix for that, along with fixes for two other bugs
found while re-inspecting the changes and adding unit tests.

Modification

- Replace recursive call to toComponentIndex with toComponentIndex0 as
intended
- Add missed "lastAccessed" racy cache invalidation in capacity(int)
method
- Fix incorrect determination of initial offset in non-zero cIndex case
of updateComponentOffsets method
- New unit tests for previously uncovered methods

Results

Fewer bugs.
normanmaurer pushed a commit that referenced this pull request Jan 24, 2019
Motivation

In #8758, @doom369 reported an infinite loop bug in CompositeByteBuf
which was introduced in #8437.

This is the same small fix for that, along with fixes for two other bugs
found while re-inspecting the changes and adding unit tests.

Modification

- Replace recursive call to toComponentIndex with toComponentIndex0 as
intended
- Add missed "lastAccessed" racy cache invalidation in capacity(int)
method
- Fix incorrect determination of initial offset in non-zero cIndex case
of updateComponentOffsets method
- New unit tests for previously uncovered methods

Results

Fewer bugs.
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.

4 participants