Artifacts Associated With Ticket c2d22775ce4c6b53
Ticket change [427efc96b9] (rid 155231) by anonymous on 2017-08-02 06:35:08:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tcl_ListObjReplace contains code: int first; int count .... if (numElems < first+count || first+count < 0) { /* * The 'first+count < 0' condition here guards agains integer * overflow in determining 'first+count'. */ So overflow is expected but it's calculated with signed type which is "undefined behavior" Proposed fix: --- old/generic/tclListObj.c 2015-11-17 17:03:00.000000000 -0800 +++ new/generic/tclListObj.c 2017-08-01 23:22:59.000000000 -0700 @@ -897,13 +897,16 @@ } if (count < 0) { count = 0; - } else if (numElems < first+count || first+count < 0) { - /* - * The 'first+count < 0' condition here guards agains integer - * overflow in determining 'first+count'. - */ + } else { + int firstWithCount = (unsigned) first + count; + if (numElems < firstWithCount || firstWithCount < 0) { + /* + * The 'first+count < 0' condition here guards agains integer + * overflow in determining 'first+count'. + */ - count = numElems - first; + count = numElems - first; + } } isShared = (listRepPtr->refCount > 1); - foundin initialized to: "8.6.4"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "61ec11df7062b717a200d064063aa94b7b27781c"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "None"
- title initialized to: "Fix signed integer overflow in Tcl_ListObjReplace"
- type initialized to: "Patch"
Ticket change [4c4d30c317] (rid 155232) by dgp on 2017-08-02 19:28:10:
- closedate changed to: "2457968.31122858"
- closer changed to: "dgp"
- icomment:
Already fixed for 8.6.7+ https://core.tcl.tk/tcl/info/b2a4266498c8dfd7
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Duplicate"
- status changed to: "Closed"