diff options
| author | Paul Eggert | 2017-12-02 21:31:24 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-12-02 21:32:26 -0800 |
| commit | 04e5b28ff1691345e023a944dc6a6a9e9573bd07 (patch) | |
| tree | 461dd9585acb4135cb9ec6ddd689bbb19cc35007 /src | |
| parent | 8227087194e0817b984ce3b15099f5eae4dc011c (diff) | |
| download | emacs-04e5b28ff1691345e023a944dc6a6a9e9573bd07.tar.gz emacs-04e5b28ff1691345e023a944dc6a6a9e9573bd07.zip | |
Fix bug in i18n/l10n optimization
This fixes a off-by-one buffer overrun bug introduced in
2017-06-04T15:39:37Z!eggert@cs.ucla.edu. Problem uncovered by an
experimental version of Emacs built with -fcheck-pointer-bounds
and running on Intel MPX hardware.
* src/editfns.c (styled_format): Avoid overrunning internal buffers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index f275f33fc52..f7c26b900a0 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4919,7 +4919,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4919 | else if (discarded[bytepos] == 1) | 4919 | else if (discarded[bytepos] == 1) |
| 4920 | { | 4920 | { |
| 4921 | position++; | 4921 | position++; |
| 4922 | if (translated == info[fieldn].start) | 4922 | if (fieldn < nspec && translated == info[fieldn].start) |
| 4923 | { | 4923 | { |
| 4924 | translated += info[fieldn].end - info[fieldn].start; | 4924 | translated += info[fieldn].end - info[fieldn].start; |
| 4925 | fieldn++; | 4925 | fieldn++; |
| @@ -4939,7 +4939,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4939 | else if (discarded[bytepos] == 1) | 4939 | else if (discarded[bytepos] == 1) |
| 4940 | { | 4940 | { |
| 4941 | position++; | 4941 | position++; |
| 4942 | if (translated == info[fieldn].start) | 4942 | if (fieldn < nspec && translated == info[fieldn].start) |
| 4943 | { | 4943 | { |
| 4944 | translated += info[fieldn].end - info[fieldn].start; | 4944 | translated += info[fieldn].end - info[fieldn].start; |
| 4945 | fieldn++; | 4945 | fieldn++; |