Skip to content

Very long string crash nodejs #232

@jlguardi

Description

@jlguardi

I've experienced some issues with long strings:

  • Very slow parsing on long strings (1MB)
  • Crash with very long strings: Due to recursive calls and string concatenation, the current implementation crashes with 100MB strings.

I've included 2 test cases to validate this behaviour:

        t.equal(
            JSON5.parse("'" + 'a'.repeat(1000 * 1000) + "'"),
            'a'.repeat(1000 * 1000),
            'parse long json string (1MB)'
        )

        t.equal(
            JSON5.parse("'" + 'a'.repeat(100 * 1000 * 1000) + "'"),
            'a'.repeat(100 * 1000 * 1000),
            'parse very long json string (100MB)'
        )

Related with #85 and #164

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions