Skip to content

NBT: Parsing byte 0 causes a StringIndexOutOfBoundsException #1240

@IllusionTheDev

Description

@IllusionTheDev

if (original.startsWith("0b", radixPrefixOffset) || original.startsWith("0B", radixPrefixOffset)) {

The radix extraction logic fails to account that a byte value (with the suffix b) can be 0. This results in the entire string being extracted and a StringIndexOutOfBoundsException to throw when parsing the next characters
final char last = builder.charAt(builder.length() - 1);

Test SNBT: {"test": 0b}

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions