Corrected the routine that parses MASKHINTS_* in cell properties to
avoid an infinite loop in the case that the mask hint does not have a number of values that is a multiple of 4.
This commit is contained in:
parent
0ae54b500a
commit
fe9ca3a4ce
|
|
@ -285,7 +285,7 @@ cifFlatMaskHints(name, value, mhd)
|
||||||
Rect r, newr;
|
Rect r, newr;
|
||||||
char *vptr, *newval, *lastval, *propvalue;
|
char *vptr, *newval, *lastval, *propvalue;
|
||||||
bool propfound;
|
bool propfound;
|
||||||
int lastlen;
|
int lastlen, numvals;
|
||||||
|
|
||||||
if (!strncmp(name, "MASKHINTS_", 10))
|
if (!strncmp(name, "MASKHINTS_", 10))
|
||||||
{
|
{
|
||||||
|
|
@ -293,8 +293,9 @@ cifFlatMaskHints(name, value, mhd)
|
||||||
vptr = value;
|
vptr = value;
|
||||||
while (*vptr != '\0')
|
while (*vptr != '\0')
|
||||||
{
|
{
|
||||||
if (sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
numvals = sscanf(vptr, "%d %d %d %d", &r.r_xbot, &r.r_ybot,
|
||||||
&r.r_xtop, &r.r_ytop) == 4)
|
&r.r_xtop, &r.r_ytop);
|
||||||
|
if (numvals == 4)
|
||||||
{
|
{
|
||||||
/* Transform rectangle to top level coordinates */
|
/* Transform rectangle to top level coordinates */
|
||||||
GeoTransRect(mhd->mh_trans, &r, &newr);
|
GeoTransRect(mhd->mh_trans, &r, &newr);
|
||||||
|
|
@ -320,6 +321,12 @@ cifFlatMaskHints(name, value, mhd)
|
||||||
while (*vptr && !isspace(*vptr)) vptr++;
|
while (*vptr && !isspace(*vptr)) vptr++;
|
||||||
while (*vptr && isspace(*vptr)) vptr++;
|
while (*vptr && isspace(*vptr)) vptr++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TxError("MASKHINTS_%s: Expected 4 values, found only %d\n",
|
||||||
|
name + 10, numvals);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if name exists already in the flattened cell */
|
/* Check if name exists already in the flattened cell */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue