Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2018-11-26 18:34:44 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2018-11-26 18:34:44 +0300
commit4bc42a87678bd0d11ea55b09a85aa8c72cdc1a85 (patch)
treef458b9ded0c7561a05282caac145f76874b5029a
parentb63e5378e389f675640fba97999b82f3ca7a44c2 (diff)
[interp] Don't throw exception on -1 division (#11777)
Backport of #9656.
-rw-r--r--mono/mini/interp/interp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mono/mini/interp/interp.c b/mono/mini/interp/interp.c
index fdea3f899c9..c1506299cbd 100644
--- a/mono/mini/interp/interp.c
+++ b/mono/mini/interp/interp.c
@@ -3543,14 +3543,14 @@ interp_exec_method_full (InterpFrame *frame, ThreadContext *context, guint16 *st
MINT_IN_CASE(MINT_DIV_I4)
if (sp [-1].data.i == 0)
THROW_EX (mono_get_exception_divide_by_zero (), ip);
- if (sp [-1].data.i == (-1))
+ if (sp [-1].data.i == (-1) && sp [-2].data.i == G_MININT32)
THROW_EX (mono_get_exception_overflow (), ip);
BINOP(i, /);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_DIV_I8)
if (sp [-1].data.l == 0)
THROW_EX (mono_get_exception_divide_by_zero (), ip);
- if (sp [-1].data.l == (-1))
+ if (sp [-1].data.l == (-1) && sp [-2].data.l == G_MININT64)
THROW_EX (mono_get_exception_overflow (), ip);
BINOP(l, /);
MINT_IN_BREAK;
@@ -3578,14 +3578,14 @@ interp_exec_method_full (InterpFrame *frame, ThreadContext *context, guint16 *st
MINT_IN_CASE(MINT_REM_I4)
if (sp [-1].data.i == 0)
THROW_EX (mono_get_exception_divide_by_zero (), ip);
- if (sp [-1].data.i == (-1))
+ if (sp [-1].data.i == (-1) && sp [-2].data.i == G_MININT32)
THROW_EX (mono_get_exception_overflow (), ip);
BINOP(i, %);
MINT_IN_BREAK;
MINT_IN_CASE(MINT_REM_I8)
if (sp [-1].data.l == 0)
THROW_EX (mono_get_exception_divide_by_zero (), ip);
- if (sp [-1].data.l == (-1))
+ if (sp [-1].data.l == (-1) && sp [-2].data.l == G_MININT64)
THROW_EX (mono_get_exception_overflow (), ip);
BINOP(l, %);
MINT_IN_BREAK;