#38 wmfto{eps,fig} dumps core

open
nobody
None
5
2001-05-09
2001-05-09
Carl Fongheiser
No

Complex wmf files containing lots of colors will cause
wmftoeps and wmftofig to dump core, because there's no
bounds checking in xf_find_color(). The patch below
attempts to fix the problem by returning the closest
available color if a new color cannot be added.

--- color.c Thu Nov 9 03:18:44 2000
+++ color.c.new Wed May 9 11:54:46 2001
@@ -14,7 +14,9 @@
} Color_entry;

int num_used;
-Color_entry color_db[512];
+#define NUM_COLORS 512
+Color_entry color_db[NUM_COLORS];
+

int xf_std_colors()
{
@@ -97,7 +99,7 @@
}
}
/* If close enough, return it: */
- if (lastnearest < goodenough)
+ if (lastnearest < goodenough || num_used >=
NUM_COLORS)
{
return(color_db[nearestcolor].color);
}

Discussion