Skip to content

Call to ics.find_devices wit a device_type filter value is broken (undefined behavior) due to wrong array reset argument #231

@pierreluctg

Description

@pierreluctg

Call to ics.find_devices wit a device_type filter value is broken (undefined behavior) due to wrong array reset argument.

For example this code will have a undefined behavior (will seg fault most of the times)

for device in ics.find_devices([ics.NEODEVICE_FIRE, ics.NEODEVICE_VCAN3]):
    print(device.Name, device.SerialNumber)

device_types_list.reset((new unsigned int(device_types_list_size)));

std::unique_ptr<unsigned int[]> requires an array-new expression (new T[n]), but the code uses new unsigned int(device_types_list_size), which allocates a single unsigned int initialized to the size value. Subsequent accesses via device_types_list[i] for i > 0 are undefined behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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