Skip to content

Avoid asking for arrays that are too big. #141

@certainmagic

Description

@certainmagic

If someone tries to serialize a json structure that's too close to Integer.MAX_VALUE bytes, ByteArrayOutputStream will fail while trying to grow its array. The failure is particularly annoying because it's an OutOfMemoryError and it will kill the JVM. The exception's message is "Requested array size exceeds VM limit".

It'd be nice if we threw a B2JsonException instead of killing the JVM. ;)

I know this can happen during serialization. We should also look for other places we use a ByteArrayOutputStream and places we might allocate an array more directly.

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