Issue 17119: Integer overflow when passing large string or tuple to Tkinter (original) (raw)

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.