diff options
| author | Kim F. Storm | 2003-12-28 00:12:45 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-12-28 00:12:45 +0000 |
| commit | d7078aefa029a7f6beea9fb0803305600ab7d0f5 (patch) | |
| tree | 4d172742a7360b0c2b38c7b1c39027bc8b10324d /src | |
| parent | 493fdc3cc3fad407c3ad3476d88658f6be8eb244 (diff) | |
| download | emacs-d7078aefa029a7f6beea9fb0803305600ab7d0f5.tar.gz emacs-d7078aefa029a7f6beea9fb0803305600ab7d0f5.zip | |
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfaces.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index f079e2e4484..55455abdbd7 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -5577,12 +5577,19 @@ cache_face (c, face, hash) | |||
| 5577 | face->id = i; | 5577 | face->id = i; |
| 5578 | 5578 | ||
| 5579 | /* Maybe enlarge C->faces_by_id. */ | 5579 | /* Maybe enlarge C->faces_by_id. */ |
| 5580 | if (i == c->used && c->used == c->size) | 5580 | if (i == c->used) |
| 5581 | { | 5581 | { |
| 5582 | int new_size = 2 * c->size; | 5582 | if (c->used == c->size) |
| 5583 | int sz = new_size * sizeof *c->faces_by_id; | 5583 | { |
| 5584 | c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz); | 5584 | int new_size, sz; |
| 5585 | c->size = new_size; | 5585 | new_size = min (2 * c->size, MAX_FACE_ID); |
| 5586 | if (new_size == c->size) | ||
| 5587 | abort (); /* Alternatives? ++kfs */ | ||
| 5588 | sz = new_size * sizeof *c->faces_by_id; | ||
| 5589 | c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz); | ||
| 5590 | c->size = new_size; | ||
| 5591 | } | ||
| 5592 | c->used++; | ||
| 5586 | } | 5593 | } |
| 5587 | 5594 | ||
| 5588 | #if GLYPH_DEBUG | 5595 | #if GLYPH_DEBUG |
| @@ -5601,8 +5608,6 @@ cache_face (c, face, hash) | |||
| 5601 | #endif /* GLYPH_DEBUG */ | 5608 | #endif /* GLYPH_DEBUG */ |
| 5602 | 5609 | ||
| 5603 | c->faces_by_id[i] = face; | 5610 | c->faces_by_id[i] = face; |
| 5604 | if (i == c->used) | ||
| 5605 | ++c->used; | ||
| 5606 | } | 5611 | } |
| 5607 | 5612 | ||
| 5608 | 5613 | ||