From 896703dde7f6fa5b835654724c5b6cfe353a92ed Mon Sep 17 00:00:00 2001 From: Pierre-Luc Date: Fri, 19 Jun 2026 11:01:07 -0400 Subject: [PATCH] Call to ics.find_devices wit a device_type filter value is broken (undefined behavior) due to wrong array reset argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fix changes `new unsigned int(device_types_list_size)` → `new unsigned int[device_types_list_size]`, so the allocation matches the `unique_ptr` type and all subsequent `device_types_list[i]` accesses are valid. Fixes https://github.com/intrepidcs/python_ics/issues/231 --- src/methods.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/methods.cpp b/src/methods.cpp index c410b459..6c56d1b9 100644 --- a/src/methods.cpp +++ b/src/methods.cpp @@ -1054,7 +1054,7 @@ PyObject* meth_find_devices(PyObject* self, PyObject* args, PyObject* keywords) if (!_convertListOrTupleToArray(device_types, &device_type_vector)) return NULL; device_types_list_size = static_cast(device_type_vector.size()); - device_types_list.reset((new unsigned int(device_types_list_size))); + device_types_list.reset(new unsigned int[device_types_list_size]); for (unsigned int i = 0; i < device_types_list_size; ++i) device_types_list[i] = (unsigned int)PyLong_AsLong(device_type_vector[i]); }