gegl:slic crashes when input includes only NANs
$ gegl -o tmp.ppm -- rectangle x=0 y=0 width=1920 height=1080 add value=-1.2 gamma value=2.1 slic
The problem is here: the buffer labels
is iterated with a GEGL_ACCESS_WRITE
iterator, but then its content is read and used to initialize best_cluster
.
When the input includes many clustered NANs it happens that this comparison always fails and best_cluster
is used as it was initialized which can be any number, so as soon it is not in [o clusters->len) the following dereference access memory outside the clusters
GArray.
Two possible solutions:
initialize best_cluster
with 0, since anyway its distance does not correspond to the initial min_distance
or use an iterator with GEGL_ACCESS_READWRITE