Skip to content

ByteBuf.nioBuffer(...) should only expose the sub-region of the buffer #1925

Closed

Description

@normanmaurer

At the moment we only set the position and limit of the buffer and return it. This is not correct as it should only expose the sub-region (as stated in the javadocs).

What makes it even worse is that this way a user can access the data from other buffers when a pooled allocator is used by mistake and so cause data-corruption.

So we should slice the buffer before return it. For internal usage we can still use internalNioBuffer(..) which does not slice and so produce less GC

Activity

  1. normanmaurer commented on Oct 16, 2013

    @normanmaurer
    MemberAuthor

    This is also related to #1920

  2. added 2 commits that reference this issue on Oct 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions