Export to GitHub

gmpy - issue #98

a null dereference in mpfr.__floor__


Posted on Aug 13, 2015 by Happy Bear

What steps will reproduce the problem? 1. from math import floor 2. from gmpy2 import mpfr 3. floor(mpfr('inf')) python would crash immediately.

What is the expected output? mpfr('inf') What do you see instead? python crashes.

What version of the product are you using? On what operating system? python3 with latest gmpy2 (downloaded last week) on windows 10

Please provide any additional information below. 'floor' receives 'PyObject *self' and 'PyObject *other', but never checks whether (NULL == other). the steps aforementioned cause a call to 'floor' while indeed (NULL == other), but then the type of 'other' is checked, which results in a crash.

Comment #1

Posted on Aug 14, 2015 by Grumpy Wombat

I can reproduce the issue but I'm still thinking about the best way to fix the issue. It may be a few days before I have a correct fix.

Comment #2

Posted on Aug 20, 2015 by Grumpy Wombat

I have released version 2.0.7 which fixes the bug. It is available at https://pypi.python.org/pypi/gmpy2

Thanks for the report!

Status: Fixed

Labels:
Type-Defect Priority-Medium