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.

classification
Title: Integer overflow when passing large string or tuple to Tkinter
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: 17118 Superseder:
Assigned To: serhiy.storchaka Nosy List: gpolo, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2013-02-03 19:35 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter_size_overflow.patch serhiy.storchaka, 2013-04-16 07:10 review
Messages (3)
msg181288 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-02-03 19:35
Second argument of Tcl_NewUnicodeObj() which specifies a number of characters has type "int". When a large string with more than INT_MAX characters passed to Tkinter this value will overflow. If this parameter is negative, all characters up to the first null character are used (up to the end of string because current string implementation has null character after the end). When string length will be more than UINT_MAX, always only part of string will be converted.

I propose explicitly check a string length and raise an exception when the length overflows C int range.
msg187052 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-04-16 07:10
Here is a patch. Please run test_tcl test on 64-bit platform with > 20 GiB of memory.

I haven't included a test for huge tuples because it requires a lot of memory (perhaps the hundreds of GiBs) and should run a long time. It is impossible to calculate exact requirements from Python side, it's TCL implementation details. I'm not sure even about a huge string test.
msg195817 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-21 18:56
New changeset 6bc533d06cf1 by Serhiy Storchaka in branch '3.3':
Issue #17119: Fixed integer overflows when processing large strings and tuples
http://hg.python.org/cpython/rev/6bc533d06cf1

New changeset b500daaee7d0 by Serhiy Storchaka in branch 'default':
Issue #17119: Fixed integer overflows when processing large strings and tuples
http://hg.python.org/cpython/rev/b500daaee7d0

New changeset ee0bb673536c by Serhiy Storchaka in branch '2.7':
Issue #17119: Fixed integer overflows when processing large Unicode strings
http://hg.python.org/cpython/rev/ee0bb673536c
History
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61321
2013-08-22 16:15:59serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-08-21 18:56:35python-devsetnosy: + python-dev
messages: + msg195817
2013-08-03 20:55:24serhiy.storchakasetassignee: serhiy.storchaka
2013-04-16 07:10:57serhiy.storchakasetfiles: + tkinter_size_overflow.patch


title: Integer overflow when passing large string to Tkinter -> Integer overflow when passing large string or tuple to Tkinter
keywords: + patch
nosy: + gpolo
versions: - Python 3.2
messages: + msg187052
stage: needs patch -> patch review
2013-02-19 00:51:50vstinnersetnosy: + vstinner
2013-02-18 21:58:01serhiy.storchakasetstage: needs patch
2013-02-03 19:35:55serhiy.storchakasetdependencies: + Add tests for testing Python-Tcl interaction
2013-02-03 19:35:39serhiy.storchakacreate