[New-bugs-announce] [issue9190] Undefined behaviour in _PyFloat_Pack4

Mark Dickinson report at bugs.python.org
Wed Jul 7 18:42:25 CEST 2010

New submission from Mark Dickinson <dickinsm at gmail.com>:

_PyFloat_Pack4 does a double-to-float cast, without first checking that the value being converted is within the range of a float.  According to C99, this results in undefined behaviour.  It should be fixed (probably via comparison with FLT_MAX before casting.)

np_float in the struct module also has this problem.

assignee: mark.dickinson
messages: 109483
nosy: mark.dickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: Undefined behaviour in _PyFloat_Pack4
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list