#1469 sys::List int32 overflow

vkuzkokov Thu 31 Mar 2011

If you type

[123].getSafe(0xFFFF_FFFF)

in fansh you'll (interestingly enough) get 123 but not null as expected. Similar thing goes for some other List methods which use conversion to int.

Not that I triggered any of this from production code. I still think it needs to be tracked.

brian Mon 4 Apr 2011

I fixed List.getSafe because that is sort of an odd case where I think underflow should be handled. But in most cases I don't think it is worth trying to check for overflow/underflow. In Java virtually everything is 32-bit and we do that conversion all over the place - it would be really expensive to add checks everywhere. Plus we have Int in JS as really a 64-bit float, so that is another twist.

vkuzkokov Mon 4 Apr 2011

The crazy thing is that in some places there already are checks after conversion.

Login or Signup to reply.