homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pkt
Recipients pkt
Date 2015年02月01日.13:53:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422798800.96.0.0931437199134.issue23362@psf.upfronthosting.co.za>
In-reply-to
Content
# Bug
# ---
# 
# PyObject *
# _PyUnicode_TranslateCharmap(PyObject *input,
# PyObject *mapping,
# const char *errors)
# {
# ...
# size = PyUnicode_GET_LENGTH(input);
# ...
# osize = size;
# 1 output = PyMem_Malloc(osize * sizeof(Py_UCS4));
# 
# 1. Input size = 2^30, so osize*sizeof(Py_UCS4)=2^32==0 (modulo 2^32) and malloc
# allocates a 0 byte buffer
# 
# Crash
# -----
# 
# Breakpoint 2, _PyUnicode_TranslateCharmap (
# input='aa...', mapping={97: 'b'}, errors=0x828c82b "ignore") at Objects/unicodeobject.c:8597
# 8597 {
# ...
# 8636 output = PyMem_Malloc(osize * sizeof(Py_UCS4));
# (gdb) print osize
# 1ドル = 1073741824
# (gdb) print osize*4
# 2ドル = 0
# (gdb) c
# Continuing.
# 
# Program received signal SIGSEGV, Segmentation fault.
# 0x0814aed2 in charmaptranslate_output (
# input='aa...', ipos=51302, mapping={97: 'b'}, output=0xbfc40860, osize=0xbfc40864, opos=0xbfc40868,
# res=0xbfc40874) at Objects/unicodeobject.c:8574
# 8574 (*output)[(*opos)++] = PyUnicode_READ_CHAR(*res, 0);
# 
# OS info
# -------
# 
# % ./python -V
# Python 3.4.1
# 
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 i686 i686 i386 GNU/Linux
# 
 
s="a"*(2**30)
s.translate({ord('a'): 'b'})
History
Date User Action Args
2015年02月01日 13:53:20pktsetrecipients: + pkt
2015年02月01日 13:53:20pktsetmessageid: <1422798800.96.0.0931437199134.issue23362@psf.upfronthosting.co.za>
2015年02月01日 13:53:20pktlinkissue23362 messages
2015年02月01日 13:53:20pktcreate

AltStyle によって変換されたページ (->オリジナル) /