Segfault due to integer overflow in TranslateInputEOL()
Closed / Fixed261a8a79f011fa26ecdaafbdc1c24c1285f48de3Created 11 years agoUpdated 11 years ago
Descriptionplain2015-11-05 15:21:17
set outfile [ open "big.tcl" w ]
set count 59000000
set current 0
while { $current != $count } {
puts $outfile "# a comment $count"
incr current
}
puts $outfile "puts \"hello world\""
Generate the file 'big.tcl' and then execute it either by sourcing it, or by running
tclsh big.tcl
#0 0x00007ffff716ab6a in memchr () from /lib64/libc.so.6
#1 0x00000000005152e8 in TranslateInputEOL (statePtr=0x878160,
dstStart=0x7fff30793020 "\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a commen"...,
srcStart=0x7fff30793020 "\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a comment 59000000\n# a commen"..., dstLenPtr=0x7fffffffd13c, srcLenPtr=0x7fffffffd140)
at /home/dgp/fossil/tcl/generic/tclIO.c:6395
#2 0x0000000000514c69 in ReadChars (statePtr=0x878160, objPtr=0x8649d0,
charsToRead=-1073733632, factorPtr=0x7fffffffd1e8)
at /home/dgp/fossil/tcl/generic/tclIO.c:6066
#3 0x00000000005146ff in DoReadChars (chanPtr=0x8833f0, objPtr=0x8649d0,
toRead=-1073733632, appendFlag=-204)
at /home/dgp/fossil/tcl/generic/tclIO.c:5793
#4 0x0000000000514492 in Tcl_ReadChars (chan=0x8833f0, objPtr=0x8649d0,
toRead=-1, appendFlag=-204) at /home/dgp/fossil/tcl/generic/tclIO.c:5678
#5 0x00000000005289e4 in Tcl_FSEvalFileEx (interp=0x8205c0, pathPtr=0x863b00,
encodingName=0x0) at /home/dgp/fossil/tcl/generic/tclIOUtil.c:1803
Referenced by2
a03fee273c[261a8a79f0] Integer overflow leads to segfault. check-in2015-11-10 16:34:048303249388[261a8a79f0] Integer overflow leads to segfault. check-in2015-11-10 16:31:29
dgpplain2015-11-05 15:41:22
On the trunk, the breaking checkin is: http://core.tcl.tk/tcl/info/d17b42d5cb7438ab
dgpplain2015-11-10 16:35:11
Simple failure to detect and handle integer overflow. Fixed now.
dgp Closed ticket [261a8a79f0].
[History diff]2015-11-10 19:00:41
Log in (anonymous is fine) to add a comment.