Skip to content

ujson.dumps crashes when indent is large #700

Description

@coco1629

When calling ujson.dumps() with large indent value, the program crashes with a segmentation fault.

Program:

import ujson
obj = {'list': [1, 2, 3], 'nested': {'key': 'value'}}
result = ujson.dumps(obj, indent=2000000000)

ujson version: 5.11.0
Actual Behavior: Program crashes with segmentation fault
Expected Behavior: The function should handle these indent values. If it's invalid, it could raise a ValueError or OverflowError ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions