.
D 2008-10-21T15:28:14
J assignee hobbs
J cmimetype text/plain
J comment \nTesting\smemory\shygiene\sin\sa\sprogram\sthat\nembeds\sTcl\son\san\sx86_64\ssystem\swith\nElectricFence,\swe\sencountered\spanics\nin\sthe\sTcl\slibrary.\n\nThe\sproblem\sboils\sdown\sto\sthis.\s\sTcl's\nTcl_Alloc()\sroutine\s(and\sthe\sckalloc()\nform)\sis\sdocumented\sto\sreturn\sa\spointer\naligned\sfor\sany\spurpose.\s\sSome\sof\sthe\nTcl\ssource\scode\sis\swritten\sassuming\sthis\nto\sbe\strue.\n\nUnfortunately,\swhen\smalloc()\sreturns\sa\npointer\sthat\sis\smisaligned\sfor\ssome\npurposes\s(notably\sfor\sholding\sa\spointer\nvalue),\sthe\sTclpAlloc()\simplementation\nin\stclThreadAlloc.c\spropagates\sthat\nmisalignment\sup\sto\sthe\spointer\sreturned\nby\sckalloc()\sleading\sto\spanics\sin\sthe\ncode\sthat\sassumes\sthis\scannot\shappen.\n\nMisaligned\smalloc()\sreturns\sis\sone\sof\nthe\shazards\sintroduced\sby\sElectricFence\ntesting.\n\nSince\sTcl_Alloc()\sis\sdocumented\sto\sreturn\nan\saligned\spointer,\sand\sit\scannot\salways\nbe\sassumed\sthat\smalloc()\swill\scooperate,\nit\swould\smake\sTcl\smore\srobust,\sand\smore\nuseful\sfor\stesting\sin\spartnership\swith\nElectricFence,\sif\sthe\sallocator\sin\ntclThreadAlloc.c\sincluded\ssafeguards\sto\nprevent\smisalignment\sfrom\sbubbling\sup\nfrom\sbelow.
J foundin obsolete:\s8.5.5
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 41.\sMemory\sAllocation
J title unaligned\smalloc()\s->\sTcl\spanic
J type Bug
K 2184717fffffffffffffffffffffffffffffffff
U dgp
Z e69f5edaf963b15fefc4c89752f071c9