LSL-SLua: casting out of bounds float->integer not compatible with Mono
in progress
Frio Belmonte
LSL-Mono is specced (edit: I can't actually find where it's
specified in writing
to do that, but it's clearly what it does... maybe it's Mono that's been wrong all along, but too late to fix now) to return INT_MIN when trying to cast floats that are out of 32-bit integer bounds. LSL-SLua doesn't, repro:default {
state_entry() {
integer i;
llOwnerSay("---");
for(i = 9; i < 17; ++i)
llOwnerSay((string)((integer)(PI*llPow(10, i))));
}
}
Under Mono, every cast returns INT_MIN, under LSL-SLua you get varying values.
llFloor, llCeil and llRound have the same specified OOB result, and work correctly for both VMs.
Log In
H
Harold Linden
Should be fixed when https://github.com/secondlife/slua/commit/fc29a283fcc2c4d4ab1bb88a264e974e5a9c614d goes to production
H
Harold Linden
marked this post as
in progress
Thanks for the report!
Yep, this would be because I was invoking UB during the float->int runtime casting. I'll get UBSan enabled and fix this one up!