[Python-Dev] IEEE/ISO draft on Python vulnerabilities

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Dec 13 11:37:32 CET 2011


2011/12/12 Victor Stinner <victor.stinner at haypocalc.com>

> "When sorting a list using the sort() method, attempting to inspect or
> mutate the content of the list will result in undefined behaviour."


But is this even true? in listobject.c::listsort(), since 2002,
/* The list is temporarily made empty, so that mutations performed
 * by comparison functions can't affect the slice of memory we're
 * sorting (allowing mutations during sorting is a core-dump
 * factory, since ob_item may change).
 */
So behaviour is not undefined at all... maybe this report is only based on
note #10 of the documentation:
http://docs.python.org/library/stdtypes.html#mutable-sequence-types
and only considers python 2.2 or older...

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20111213/7595f764/attachment.html>


More information about the Python-Dev mailing list