[issue9834] PySequence_GetSlice() lacks a NULL check

Stefan Behnel report at bugs.python.org
Sat Sep 11 13:24:46 CEST 2010


New submission from Stefan Behnel <scoder at users.sourceforge.net>:

PySequence_GetSlice() in Objects/abstract.c contains the following code:

    mp = s->ob_type->tp_as_mapping;
    if (mp->mp_subscript) {

This crashes when the type's "tp_as_mapping" is NULL. The obvious fix is to simply write

    if (mp && mp->mp_subscript)

as basically everywhere else around that function. The problem seems to have occurred during a rewrite for Python 3, it's ok in the 2.x series.

----------
components: Interpreter Core
messages: 116092
nosy: scoder
priority: normal
severity: normal
status: open
title: PySequence_GetSlice() lacks a NULL check
type: crash
versions: Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9834>
_______________________________________


More information about the Python-bugs-list mailing list