<i>possible signed integer overflow in Tcl_GetLongFromObj(), Tcl_GetWideIntFromObj()</i>.
by
.
D 2022-02-16T02:15:18.910
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment If\s<tt>Tcl_GetLongFromObj()</tt>\sor\s<tt>Tcl_GetWideIntFromObj()</tt>\sretrieve\sfrom\sa\sbignum\swhose\svalue\sis\s<tt>LONG_MIN</tt>\sor\s<tt>WIDE_MIN</tt>\srespectively,\sthen\sI\sbelieve\sthere\swill\sbe\ssigned\sinteger\soverflow\s(undefined\sbehavior)\son\s2's\scomplement\ssystems.\r\n\r\nThe\sattached\spatch\sshould\savoid\sthis\sby\susing\sthe\ssame\sapproach\ssuggested\sfor\s[89de498973]:\snegate\sbefore\scasting,\sand\sby\ssubtracting\sfrom\s0\s(binary\sminus)\sto\savoid\scompiler\swarnings\sfor\sunary\sminus\swith\sunsigned\soperand\s(e.g.\s[https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146|MSVC\s<tt>/W2</tt>\swarning\sC4146]).\sHowever\sI\shave\snot\sidentified\sa\sTcl\ssyntax\sexample\sto\strigger\sthe\soverflow,\sas\sI\shave\snot\sfound\show\sto\screate\sa\sbignum\swith\sa\svalue\srepresentable\sby\s<tt>long</tt>\sor\s<tt>Tcl_WideInt</tt>\sthat\scan\sbe\ssaved\sand\sused\sby\sa\scommand\sthat\sthen\spasses\sit\sto\sTcl_GetLongFromObj()\sor\sTcl_GetWideIntFromObj();\smaybe\sI\scan\scome\sup\swith\sa\sC\sexample.
J foundin core-8-6-branch
J is_private 0
J login chrstphrchvz
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter chrstphrchvz
J subsystem 48.\sNumber\sHandling
J title possible\ssigned\sinteger\soverflow\sin\sTcl_GetLongFromObj(),\sTcl_GetWideIntFromObj()
J type Patch
K c6fea6ba6f6b2841ad4d1a569ccc3cb6f6484abc
U chrstphrchvz
Z b8b240edf232ffb2156b2c7092a99d03