Skip to content

Add explicit bounds checks for JsonGenerator methods that take byte[]/char[]/String-with-offsets input #811

Closed
@cowtowncoder

Description

@cowtowncoder

(note: inspired by issues like https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50065 uncovered by oss-fuzz)

Currently many of the write methods, like:

    public void writeRaw(char[] text, int offset, int len);

in JsonGenerator do not explicitly check validity of offset and len wrt to input buffer (text).
So they will fail for things like ArrayIndexOutOfBounds exception, possibly after writing some of the content.
It would make more sense to validate bounds first and give meaningful exception instead (StreamWriteException).

Metadata

Metadata

Assignees

No one assigned

    Labels

    oss-fuzzIssue uncovered by oss-fuzz fuzzer

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions