From: "xi (Xi Wang)" Date: 2012-11-16T17:24:44+09:00 Subject: [ruby-core:49411] [ruby-trunk - Bug #7371][Open] Fix undefined overflow checking in bigdecimal Issue #7371 has been reported by xi (Xi Wang). ---------------------------------------- Bug #7371: Fix undefined overflow checking in bigdecimal https://bugs.ruby-lang.org/issues/7371 Author: xi (Xi Wang) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.x In AddExponent() at ext/bigdecimal/bigdecimal.c:3677, the overflow checks rely on signed integer overflow, which is undefined behavior in C. SIGNED_VALUE m = e+n; SIGNED_VALUE eb, mb; if(e>0) { if(n>0) { mb = m*(SIGNED_VALUE)BASE_FIG; eb = e*(SIGNED_VALUE)BASE_FIG; if(mb