Skip to content

No limits for nesting in JSON #108

Description

@hourianto

The parser is recursive for skipped values, objects, arrays, sets, tuples, and JsonNode. There is no nesting limit or iterative fallback. Large nesting depth can exhaust the call stack.

import jsony
import std/os
import std/strutils

let depth =
  if paramCount() >= 1:
    parseInt(paramStr(1))
  else:
    100000

let payload = repeat("[", depth) & "0" & repeat("]", depth)
discard payload.fromJson()

Found by GPT 5.4.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions