Commit d7078aef authored by Kim F. Storm's avatar Kim F. Storm

(cache_face): Abort if c->size exceeds MAX_FACE_ID.

parent 493fdc3c
......@@ -5577,12 +5577,19 @@ cache_face (c, face, hash)
face->id = i;
/* Maybe enlarge C->faces_by_id. */
if (i == c->used && c->used == c->size)
if (i == c->used)
{
int new_size = 2 * c->size;
int sz = new_size * sizeof *c->faces_by_id;
c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz);
c->size = new_size;
if (c->used == c->size)
{
int new_size, sz;
new_size = min (2 * c->size, MAX_FACE_ID);
if (new_size == c->size)
abort (); /* Alternatives? ++kfs */
sz = new_size * sizeof *c->faces_by_id;
c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz);
c->size = new_size;
}
c->used++;
}
#if GLYPH_DEBUG
......@@ -5601,8 +5608,6 @@ cache_face (c, face, hash)
#endif /* GLYPH_DEBUG */
c->faces_by_id[i] = face;
if (i == c->used)
++c->used;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment