Skip to content

Fix BytesReader.read offset handling #80

@peter-jerry-ye

Description

@peter-jerry-ye

BytesReader.read checks offset >= self.len and wraps offsets with % bytes.length(). The offset should be validated against the destination buffer length, and modulo should not be used (it can corrupt writes).

Suggested fix: compare offset to bytes.length() and return None for out-of-range offsets. Remove modulo wrapping.

Refs: lib/reader_impl.mbt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions