[MacRuby] #1281: Multiplication of ~32 bit integers giving incorrect results
#1281: Multiplication of ~32 bit integers giving incorrect results ------------------------------+--------------------------------------------- Reporter: zgavin@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Multiplication of two integers around 32 bits in length can lead to what appears to be a buffer overflow and incorrect results: For example: {{{ irb(main):001:0> ((2**32)-(2**29))*(2**32) => -2305843009213693952 irb(main):002:0> (2**32)*(2**32) => 0 irb(main):003:0> (2**32)*(2**32+2**31) => 27670116110564327424 }}} Both of these are -- Ticket URL: <http://www.macruby.org/trac/ticket/1281> MacRuby <http://macruby.org/>
#1281: Multiplication of ~32 bit integers giving incorrect results ------------------------------+--------------------------------------------- Reporter: zgavin@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Changes (by lsansonetti@…): * milestone: => MacRuby 1.0 Comment: Yesterday Vincent found out that the overflow check is removed by the LLVM optimization passes. In kernel.c: {{{ if (FIXABLE(res) && res / a == b) { return LONG2FIX(res); } }}} The {{{res / a // b}}} expression is removed. This needs to be fixed for 1.0. -- Ticket URL: <http://www.macruby.org/trac/ticket/1281#comment:1> MacRuby <http://macruby.org/>
#1281: Multiplication of ~32 bit integers giving incorrect results ------------------------------+--------------------------------------------- Reporter: zgavin@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 1.0 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Changes (by vincent.isambart@…): * status: new => closed * resolution: => fixed Comment: Should be fixed by https://github.com/MacRuby/MacRuby/commit/cbb095131a78885126ec230150b2676a00... -- Ticket URL: <http://www.macruby.org/trac/ticket/1281#comment:2> MacRuby <http://macruby.org/>
#1281: Multiplication of ~32 bit integers giving incorrect results ------------------------------+--------------------------------------------- Reporter: zgavin@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 1.0 => MacRuby 0.11 -- Ticket URL: <http://www.macruby.org/trac/ticket/1281#comment:3> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby