Skip to content
Tcl Source Code Artifact [408805415d]
Login

Artifact [408805415d]

Artifact 408805415d9839594707e1ad72d8c6b11dd0e3e2aca312eb63ef1f74a9c9392a:

Ticket change [408805415d] - Ticket [8dd2807066d7cc4d|8dd2807066] <i>bug in single-argument &#39;max&#39; with bignums</i> status still Closed with 5 other changes by apnadkarni on 2025-11-13 03:56:41.
D 2025-11-13T03:56:41.000
J closedate 2460992.66436343
J closer apnadkarni
J icomment Sergey,\syour\sfix\sseems\sfine\sfor\sthe\s**current**\simplementation\sbut\sI\sam\suncomfortable\swith\sit\sfor\sthe\sfollowing\sreason.\s\r\n\r\nThe\s`Tcl_GetNumberFromObj`\s(which\sthe\sGetNumberFromObj\smacro\stranslates\sto)\ssay\s\r\n\r\n*When\scallers\sof\sthese\sroutines\sread\snumeric\svalues\sthrough\sthe\sreported\sstorage\spointer,\sthey\sare\saccessing\smemory\sthat\sbelongs\sto\sthe\sTcl\slibrary.\sThe\sTcl\slibrary\shas\sthe\spower\sto\soverwrite\sor\sfree\sthis\smemory.\sThe\sstorage\spointer\sreported\sby\sa\scall\sto\sTcl_GetNumber\sor\sTcl_GetNumberFromObj\sshould\snot\sbe\sused\safter\sthe\ssame\sthread\shas\spossibly\sreturned\scontrol\sto\sthe\sTcl\slibrary.*\r\n\r\nThus,\sas\sdocumented,\sthere\sis\sno\sguarantee\sthat\sptr1\sis\seven\svalid\sanymore\safter\sthe\ssecond\scall\sto\s`GetNumberFromObj`.\sThe\simplementation\sis\sassuming\sthe\ssame\sthread\slocal\sstorage\sis\sreused\sfor\sbignums\son\severy\scall.\sI\scan\simagine\sa\spossibility\sthat\sif\san\sexisting\sallocation\sfrom\sa\sprevious\scall\sis\stoo\sbig\sfor\sa\ssmaller\sbignum,\sit\sis\sreallocated.\sIn\swhich\scase\sptr1\smay\sbe\s!=\sptr2\sbut\sno\slonger\seven\spoints\sto\svalid\sstorage.\sI\sdon't\sknow\sthe\sinternal\sdetails\sof\sbignums\sso\sperhaps\sthis\sis\snot\sa\spossible\sbut\sthe\spoint\sis\sthe\sunderlying\sbignum\simplementation\scan\schange\sand\sit's\ssafer\sto\snot\srely\son\sit\sfrom\smodules\sthat\sare\snot\spart\sof\sbignum\sitself.\r\n\r\nBut\syou\sand\sJan\sare\smore\scompetent\sto\smake\sthat\scall;\sI'm\sjust\svoicing\smy\sconcern.
J login apnadkarni
J mimetype text/x-markdown
K 8dd2807066d7cc4d8604164f39b7f0d65c0dc321
U apnadkarni
Z a789eb48b5c80d1c64b0636b0abebb78