diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-03 13:12:14 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-03 13:12:14 (GMT) |
commit | f8de6ef33750755f497c6724c12eba1c37c3370f (patch) | |
tree | df946e262813b4c1c062bc2fe2549c7369c3bd00 | |
parent | e10f92249af8322f5e4d9f1fae6bcdd21f00924d (diff) | |
parent | d72792591c268e1d4022885dcc8b0afeef200670 (diff) | |
download | tk-f8de6ef33750755f497c6724c12eba1c37c3370f.zip tk-f8de6ef33750755f497c6724c12eba1c37c3370f.tar.gz tk-f8de6ef33750755f497c6724c12eba1c37c3370f.tar.bz2 |
Fix [f325020623898d6afe8bb73276459a922003c077|f325020623]: Tk crashes when drawing many dashed objects
-rw-r--r-- | generic/tkCanvUtil.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index cbbc2b4..09ce98c 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -1136,7 +1136,9 @@ Tk_ConfigOutlineGC( if (mask && (dash->number != 0)) { gcValues->line_style = LineOnOffDash; gcValues->dash_offset = outline->offset; - if (dash->number > 0) { + if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + gcValues->dashes = dash->pattern.pt[0]; + } else if (dash->number != 0) { gcValues->dashes = dash->pattern.array[0]; } else { gcValues->dashes = (char) (4 * width + 0.5); @@ -1340,7 +1342,9 @@ Tk_ResetOutlineGC( if ((dash->number > 2) || (dash->number < -1) || (dash->number==2 && (dash->pattern.array[0] != dash->pattern.array[1])) || ((dash->number == -1) && (dash->pattern.array[0] != ','))) { - if (dash->number > 0) { + if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + dashList = dash->pattern.pt[0]; + } else if (dash->number != 0) { dashList = dash->pattern.array[0]; } else { dashList = (char) (4 * width + 0.5); |