Skip to content

null, true, and false parsing accepts bad input #357

Open

Description

@mtdowling

Various places in this library that parse null will see 'n' and then skip the next three characters without validating that the next three characters are 'u' 'l' 'l'. So this is parsed as null: nope.

See for example https://github.com/json-iterator/java/blob/master/src/main/java/com/jsoniter/IterImplObject.java#L10-L12

    public static final String readObject(JsonIterator iter) throws IOException {
        byte c = IterImpl.nextToken(iter);
        switch (c) {
            case 'n':
                IterImpl.skipFixedBytes(iter, 3);
                return null;

Edit: also note that this same issue is present for true and false.

Activity

  1. tdila commented on Aug 12, 2024

    @tdila

    Hello, I'm new to open-source contribution and I would like to help. Are you working on this? if not, can you please assign this to me?

  2. mtdowling commented on Aug 13, 2024

    @mtdowling
    Author

    I’m not working on this, please feel free.

  3. tdila commented on Aug 13, 2024

    @tdila

    @mtdowling thanks 👍

  4. bodasiddartha commented on Aug 26, 2024

    @bodasiddartha

    @mtdowling I'm new to open source and I would love to give it a try(even if it does not help).

  5. ChristoJobyAntony commented on Oct 11, 2024

    @ChristoJobyAntony

    Hey, we are a team of 5 university students working on contributing to OSS projects. We would love to work on this issue if it is still unassigned. Thank you for your time.

  6. MurilloTox commented on Dec 18, 2025

    @MurilloTox

    @mtdowling I have resolved this issue, can you give the permission to cratemy branch and make a push?

  7. mtdowling commented on Dec 18, 2025

    @mtdowling
    Author

    I am not a maintainer of this repo, so I can't give any permissions to this repo.

  8. changed the title [-]Null parsing accepts bad input[/-] [+]null, true, and false parsing accepts bad input[/+] on Dec 18, 2025
  9. abhisheks-gh commented on Dec 31, 2025

    @abhisheks-gh

    Hi @mtdowling , thanks for the above given details. Could you please assign this issue to me. Would be happy to implement the fix.

    Thanks.

  10. added a commit that references this issue on Jan 1, 2026
  11. abhisheks-gh commented on Jan 27, 2026

    @abhisheks-gh

    Hi @mtdowling , I have opened a MR for this issue - PR #367 .

    Could you please check and approve that? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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