Skip to content

Memory leak in rb_version_sort_1 #16

@philipturnbull

Description

@philipturnbull

rb_version_sort_1 manually allocates/frees versions which doesn't play nice with exceptions.

This is reasonably hard to hit but can be triggered by:

VersionSorter.sort(["1"]) { |x| raise 'oh noes' }

which causes an exception to be throw by rb_yield:

if (rb_block_given_p())
rb_version_string = rb_yield(rb_version);

and

VersionSorter.sort ["\0"]

which causes an exception to be thrown by StringValueCStr because it contains embedded NULs:

versions[i] = parse_version_number(StringValueCStr(rb_version_string));

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