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

Created on 2013-02-03 19:35 by serhiy.storchaka, last changed 2013-04-16 07:10 by serhiy.storchaka.

Files
File name Uploaded Description Edit
tkinter_size_overflow.patch serhiy.storchaka, 2013-04-16 07:10 review
Messages (2)
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.
History
Date User Action Args
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:50hayposetnosy: + haypo
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