Skip to content

Inconsistent location comparison #935

@kkarbowiak

Description

@kkarbowiak

This is related to libvroom.

If I have a location created using an index

auto lhs = vroom::Location(1);

and a location created using coordinates

auto rhs = vroom::Location(vroom::Coordinates{10, 11});

I would expect the below to pass

assert(!(lhs == rhs));

but this is not always the case. The comparison code checks presence of index only on left hand side object and assumes the right hand side object to have index as well. This reads to reading from an uninitialised member variable, which is undefined behaviour.

If I flip the arguments

assert(!(rhs == lhs));

the bug is bypassed and result is correct.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions