nanosvg
nanosvg copied to clipboard
nsvg__xformInverse clobbers the input matrix with non-invertible input
When xformInverse detects a non-invertible matrix it sets the input 't' to identity instead of the output 'inv'.
static void nsvg__xformInverse(float* inv, float* t)
{
double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1];
if (det > -1e-6 && det < 1e-6) {
nsvg__xformIdentity(t); // <- should be xformIdentity(inv)
return;
}
<...>
}
Agree. "inv" expected to be returned else it will be undefined.