Overview
| Artifact ID: | 23b5544ff36f6bd335839a193ded02ee67d2bb56 |
|---|---|
| Ticket: | a3fb3356b76ec4a853d1b86aadc08675f8bef359
Segmentation fault due to int overflow in GrowEvaluationStack |
| User & Date: | victorb on 2017-05-29 12:23:18 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
In GrowEvaluationStack(ExecEnv *eePtr, int growth,int move), the "growth" argument is of the signed int type which means that this API cannot be used to allocate more than 2GB of memory. There is no range check either, so if a Tcl command tries to allocate more than 2GB, the API just silently corrupts memory. Specifically, the bug was found by trying to do lsort on a very large list. a) create a very large list (e.g. 108707840 entries) of string, called, for example, $names. b) sort and uniquify the list: set sorted_unique_names [lsort -unique $names] # This will cause a memory error The top of the stacktrace is: #0 0x0000000014700aa1 in GrowEvaluationStack (eePtr=0x1e2c9a80, growth=-210747392, move=0) at /global/sde_apps/tcl/m/prod/tcl/tcl8.6/generic/tclExecute.c:1124 #1 0x000000001470172f in StackAllocWords () at /global/sde_apps/tcl/m/prod/tcl/tcl8.6/generic/tclExecute.c:1252 #2 0x0000000014702302 in TclStackAlloc (interp=0x1e2c6c00, numBytes=-1685979136) at /global/sde_apps/tcl/m/prod/tcl/tcl8.6/generic/tclExecute.c:1349 #3 Tcl_LsortObjCmd (clientData=0x0, interp=0x1e2c6c00, objc=3, objv=0x1e2d4e70) at /global/sde_apps/tcl/m/prod/tcl/tcl8.6/generic/tclCmdIL.c:3960 - foundin changed to: "8.6"
- is_private changed to: "0"
- login: "victorb"
- priority changed to: "5 Medium"
- private_contact changed to: "6c72cad08b0f1956fbe1a370500e97a6c84dc157"
- resolution changed to: "None"
- severity changed to: "Severe"
- status changed to: "Open"
- submitter changed to: "victorb"
- subsystem changed to: "41. Memory Allocation"
- title changed to:
Segmentation fault due to int overflow in GrowEvaluationStack
- type changed to: "Bug"