Skip to content

IndexOutOfBoundsException with Emoji in YAML #508

@twonirwana

Description

@twonirwana

Characters that are represented by more then one byte in UTF-8 can produce java.lang.IndexOutOfBoundsException: Range [1024, 1024 + 1) out of bounds for length 1024 if there are at place where they are split up in two buffers.
This can be reproduced with the code below and jackson-dataformat-yaml-2.18.1

 @Test
    void test() throws JsonProcessingException {
       String p = """
                   ---
                   value: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
                   000000000000000000000000000000000000000000000000000000000000000000000🪺"
                """;
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        mapper.readValue(p, Object.class);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    yamlIssue related to YAML format backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions