[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 88ba49f: Fix coding.c subscript error
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-24 88ba49f: Fix coding.c subscript error |
Date: |
Wed, 21 Jan 2015 08:29:36 +0000 |
branch: emacs-24
commit 88ba49fe356ecbb57f604158c432f1044d50b0bb
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix coding.c subscript error
* coding.c (CODING_ISO_INVOKED_CHARSET):
Avoid undefined behavior if CODING_ISO_INVOCATION returns negative.
---
src/ChangeLog | 4 ++++
src/coding.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index fcbc7dc..43e5641 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2015-01-21 Paul Eggert <address@hidden>
+ Fix coding.c subscript error
+ * coding.c (CODING_ISO_INVOKED_CHARSET):
+ Avoid undefined behavior if CODING_ISO_INVOCATION returns negative.
+
Backport: correct old fix for GTK font selection
* gtkutil.c (xg_get_font): Fix off-by-2 typo.
Fixes: bug#3228
diff --git a/src/coding.c b/src/coding.c
index 77583d0..8dc39e7 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -395,7 +395,8 @@ static Lisp_Object Vbig5_coding_system;
#define CODING_ISO_BOL(coding) \
((coding)->spec.iso_2022.bol)
#define CODING_ISO_INVOKED_CHARSET(coding, plane) \
- CODING_ISO_DESIGNATION ((coding), CODING_ISO_INVOCATION ((coding), (plane)))
+ (CODING_ISO_INVOCATION (coding, plane) < 0 ? -1 \
+ : CODING_ISO_DESIGNATION (coding, CODING_ISO_INVOCATION (coding, plane)))
#define CODING_ISO_CMP_STATUS(coding) \
(&(coding)->spec.iso_2022.cmp_status)
#define CODING_ISO_EXTSEGMENT_LEN(coding) \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 88ba49f: Fix coding.c subscript error,
Paul Eggert <=