Skip to content

Fuzzing exhibits memory leak in loads #148

Description

@regit

I'm using rapidjson inside one of my project and when using pythonfuzz on it I did realize that a memory leak was seen in rapidjson. Fuzzing the loads function is triggering a fuzzer OOM kill after some minutes when a decent corpus is used.

The following script exhibits the problem:

from pythonfuzz.main import PythonFuzz
import rapidjson

@PythonFuzz
def fuzz(buf):
    try:
        dbuf = buf.decode('utf-8')
        rapidjson.loads(dbuf)
    except rapidjson.JSONDecodeError:
        pass
    except UnicodeDecodeError:
        pass
    except UnicodeError:
        pass


if __name__ == '__main__':
    fuzz()

To run it install pythonfuzz module and simply run the script.

I can share my corpus privately if you want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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