jpcy / xatlas

Mesh parameterization / UV unwrapping library
MIT License
2.06k stars 221 forks source link

Off-by-one error in nlCRSMatrixNewFromSparseMatrix #96

Closed matyas-hollmann closed 3 years ago

matyas-hollmann commented 3 years ago

I think these two lines were accidentally swapped: https://github.com/jpcy/xatlas/blob/master/source/xatlas/xatlas.cpp#L4297-L4298 In the current implementation, there is an off-by-one error on line 4298 (xatlas.cpp); leading to a heap-buffer-overflow error caused by CRS->rowptr[cur_row + 1] in the last iteration when cur_row == M->m (the array length of CRS->rowptr is only M->m + 1).