Skip to content

init_repository crash on None input #688

Closed
@alexmnazarenko

Description

@alexmnazarenko

Hi! Not sure if I should post this here or in libgit2.

Caught the segfault testing my pygit2 integration.

Very simple to reproduce:

import pygit2
pygit2.init_repository(None)

Result (Ubuntu 14.04):
Segmentation fault (core dumped)

Debugger says that crash occurs in inside libgit2 in some strlen call. Looks like None is converted to NULL (by cffi?), which is unexpected by git_repository_init_ext.

For now I've added type check in my code, but segfaults aren't really expected in python. Mb add TypeError in python layer?

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