diff options
| author | Paul Eggert | 2011-09-26 08:27:22 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-09-26 08:27:22 -0700 |
| commit | 125b3835e556b6c7d967148f09ed15c0a4747d14 (patch) | |
| tree | 5ca125db8042921df9ce30a4af60ba4b794bb3e7 /src | |
| parent | c96e5d6aa74df84229cf71ccb098dac5411860c1 (diff) | |
| download | emacs-125b3835e556b6c7d967148f09ed15c0a4747d14.tar.gz emacs-125b3835e556b6c7d967148f09ed15c0a4747d14.zip | |
* floatfns.c (Fexpt): Avoid undefined signed * signed overflow.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/floatfns.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ff0972fd0f1..9857461143a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -286,6 +286,7 @@ | |||
| 286 | (Fdo_auto_save, Fset_buffer_auto_saved) | 286 | (Fdo_auto_save, Fset_buffer_auto_saved) |
| 287 | (Fclear_buffer_auto_save_failure): | 287 | (Fclear_buffer_auto_save_failure): |
| 288 | Don't assume time_t is signed, or that it fits in int. | 288 | Don't assume time_t is signed, or that it fits in int. |
| 289 | * floatfns.c (Fexpt): Avoid undefined signed * signed overflow. | ||
| 289 | * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec, concat) | 290 | * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec, concat) |
| 290 | (string_char_byte_cache_charpos, string_char_byte_cache_bytepos) | 291 | (string_char_byte_cache_charpos, string_char_byte_cache_bytepos) |
| 291 | (string_char_to_byte, string_byte_to_char) | 292 | (string_char_to_byte, string_byte_to_char) |
diff --git a/src/floatfns.c b/src/floatfns.c index 2011b4d942d..6158b9bd26d 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -484,7 +484,8 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, | |||
| 484 | && INTEGERP (arg2) /* don't promote, if both are ints, and */ | 484 | && INTEGERP (arg2) /* don't promote, if both are ints, and */ |
| 485 | && 0 <= XINT (arg2)) /* we are sure the result is not fractional */ | 485 | && 0 <= XINT (arg2)) /* we are sure the result is not fractional */ |
| 486 | { /* this can be improved by pre-calculating */ | 486 | { /* this can be improved by pre-calculating */ |
| 487 | EMACS_INT acc, x, y; /* some binary powers of x then accumulating */ | 487 | EMACS_INT y; /* some binary powers of x then accumulating */ |
| 488 | EMACS_UINT acc, x; /* Unsigned so that overflow is well defined. */ | ||
| 488 | Lisp_Object val; | 489 | Lisp_Object val; |
| 489 | 490 | ||
| 490 | x = XINT (arg1); | 491 | x = XINT (arg1); |