micropython-ulab
micropython-ulab copied to clipboard
[BUG] crash in (arg)min (and probably (arg)max)
Describe the bug
A clear and concise description of what the bug is. Give the ulab version
MicroPython v1.19.1-837-g67fac4ebc on 2023-01-24; linux [GCC 4.2.1] version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> from lab import numpy as np
>>> a=np.array([range(200000)])
>>> np.min(a, axis=1)
Segmentation fault
Expected behavior python3 and numpy give:
>>> np.min(_, axis=1)
array([0])
Additional context Found by automated fuzzing
While this is still incorrect
>>> np.min(np.array([range(5)]), axis=1)
0.0
it, at least, doesn't segfault. So, are we dealing with a problem here that is much deeper than ulab? If I simply create the array from the range, then
>>> np.array([range(200000)])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 1600000 bytes