diff options
| author | Paul Eggert | 2011-07-28 14:31:33 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-28 14:31:33 -0700 |
| commit | ca9ce8f2cb9d3d70c4e7d9dc9299ea4d5d71dfbc (patch) | |
| tree | e4e42ca73a6f80d97ff9a3f1b224699e1336bc43 /src/lisp.h | |
| parent | 7bd4252299e9ed464cac124ac1ff718c98396df2 (diff) | |
| download | emacs-ca9ce8f2cb9d3d70c4e7d9dc9299ea4d5d71dfbc.tar.gz emacs-ca9ce8f2cb9d3d70c4e7d9dc9299ea4d5d71dfbc.zip | |
Integer and memory overflow fixes for display code.
* dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int.
* dispnew.c (adjust_glyph_matrix, realloc_glyph_pool, scrolling_window):
Check for overflow in size calculations.
(line_draw_cost, realloc_glyph_pool, add_row_entry):
Don't assume glyph table len fits in int.
(struct row_entry.bucket, row_entry_pool_size, row_entry_idx)
(row_table_size): Now ptrdiff_t, not int.
(scrolling_window): Avoid overflow in size calculations.
Don't update size until allocation succeeds.
* fns.c (concat): Check for overflow in size calculations.
(next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT.
* lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
(NEXT_ALMOST_PRIME_LIMIT): New constant.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h index 2d326043614..267bfe1b21f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1704,6 +1704,11 @@ typedef struct { | |||
| 1704 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) | 1704 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) |
| 1705 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) | 1705 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) |
| 1706 | 1706 | ||
| 1707 | #define RANGED_INTEGERP(lo, x, hi) \ | ||
| 1708 | (INTEGERP (x) && (lo) <= XINT (x) && XINT (x) <= (hi)) | ||
| 1709 | #define TYPE_RANGED_INTEGERP(type, x) \ | ||
| 1710 | RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)) | ||
| 1711 | |||
| 1707 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) | 1712 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) |
| 1708 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) | 1713 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) |
| 1709 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) | 1714 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) |
| @@ -2551,6 +2556,7 @@ extern void syms_of_syntax (void); | |||
| 2551 | 2556 | ||
| 2552 | /* Defined in fns.c */ | 2557 | /* Defined in fns.c */ |
| 2553 | extern Lisp_Object QCrehash_size, QCrehash_threshold; | 2558 | extern Lisp_Object QCrehash_size, QCrehash_threshold; |
| 2559 | enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; | ||
| 2554 | extern EMACS_INT next_almost_prime (EMACS_INT); | 2560 | extern EMACS_INT next_almost_prime (EMACS_INT); |
| 2555 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); | 2561 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); |
| 2556 | extern void sweep_weak_hash_tables (void); | 2562 | extern void sweep_weak_hash_tables (void); |