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

Closed

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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