You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. The library seems to have undefined behavior, specifically signed integer overflow. include/FastNoiseLite.h:484:10: runtime error: signed integer overflow: 1337 * 668265261 cannot be represented in type 'int'
Right and it will work almost always.
There are cases where signed integer overflow being undefined behavior can cause confusion.
intfoo(intx) {
returnx+1>x;
}
The optimizer will take advantage of this fact and return 1 regardless of the value x + 1 which may overflow.
But more importantly direclty importing the c library into a zig code base is affected by this issue. Because zig is very strict about violating undefined behavior the example fails in debug builds. This can easily be fixed on zig side by using the overflow operator. Just thought I'd share.
Hi. The library seems to have undefined behavior, specifically signed integer overflow.
include/FastNoiseLite.h:484:10: runtime error: signed integer overflow: 1337 * 668265261 cannot be represented in type 'int'
Is this intended, if so what is the reason?
The text was updated successfully, but these errors were encountered: