summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans@users.sourceforge.net <jan.nijtmans>2017-01-03 13:05:16 (GMT)
committernijtmans@users.sourceforge.net <jan.nijtmans>2017-01-03 13:05:16 (GMT)
commita581b1707b5da454813c216fb34b5e0a51526776 (patch)
tree226e34ef559fa313018518f4016b76988df5c2cd /generic
parenta41d734ea8a87cbdf5c2c2864048ae2ae14d3a35 (diff)
downloadtk-a581b1707b5da454813c216fb34b5e0a51526776.zip
tk-a581b1707b5da454813c216fb34b5e0a51526776.tar.gz
tk-a581b1707b5da454813c216fb34b5e0a51526776.tar.bz2
Fix [f325020623898d6afe8bb73276459a922003c077|f325020623]: Tk crashes when drawing many dashed objects
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvUtil.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index b4d0c3b..08aeab7 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -1134,7 +1134,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);
@@ -1338,7 +1340,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);