Skip to content

Segmentation Fault when adding an empty list of vehicles #118

@jorchube

Description

@jorchube

Hello,

When setting an empty list of vehicles pyvroom the python process crashes with a Segmentation Fault.

Setting an empty list of vehicles for the problem instance is obviously not what anyone would intend to do and is something that one might want to detect early in its logic, but it may be inviable to anticipate what other scenarios end up triggering a segfault.

Nevertheless, a segmentation fault in the python process itself is something that code making use of pyvroom can not defent itself against or recover from, is fairly unexpected and is something that makes detecting and debugging the actual issue much harder.

It would be a great improvement even just throwing a generic RuntimeError.

Here is a minimal code reproducing the segfault with pyvroom version 1.14.0 on Ubuntu (kernel 6.5.0) aarch64:

def segfault_poc():
    problem_instance = vroom.Input()
    job = vroom.Job(
        1,
        location=1,
        time_windows=[vroom.TimeWindow(start=0, end=3600)],
        service=1,
    )
    problem_instance.set_durations_matrix(
        profile="car",
        matrix_input=[[0, 100], [100, 0]],
    )
    problem_instance.add_job(job)
    problem_instance.add_vehicle([])
    problem_instance.solve(exploration_level=5, nb_threads=4)

Thank you very much for your work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions