[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117502: * coding.c (ALLOC_CONVERSION_WORK_AREA): Pr
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117502: * coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and |
Date: |
Wed, 09 Jul 2014 10:37:00 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117502
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2014-07-09 14:36:35 +0400
message:
* coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and
so avoid integer overflow if decoded gap size exceeds INT_MAX bytes.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/coding.c coding.c-20091113204419-o5vbwnq5f7feedwu-1077
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-09 06:25:35 +0000
+++ b/src/ChangeLog 2014-07-09 10:36:35 +0000
@@ -15,6 +15,9 @@
* xfont.c (xfont_open):
* xftfont.c (xftfont_open): All users changed.
+ * coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and
+ so avoid integer overflow if decoded gap size exceeds INT_MAX bytes.
+
2014-07-09 Eli Zaretskii <address@hidden>
* xdisp.c (move_it_to): Adjust calculation of line_start_x to what
=== modified file 'src/coding.c'
--- a/src/coding.c 2014-07-01 15:34:58 +0000
+++ b/src/coding.c 2014-07-09 10:36:35 +0000
@@ -7273,15 +7273,12 @@
#define ALLOC_CONVERSION_WORK_AREA(coding, size) \
do { \
- int units = (size) + MAX_CHARBUF_EXTRA_SIZE; \
- \
- if (units > MAX_CHARBUF_SIZE) \
- units = MAX_CHARBUF_SIZE; \
- coding->charbuf = SAFE_ALLOCA ((units) * sizeof (int)); \
- coding->charbuf_size = (units); \
+ ptrdiff_t units = min ((size) + MAX_CHARBUF_EXTRA_SIZE, \
+ MAX_CHARBUF_SIZE); \
+ coding->charbuf = SAFE_ALLOCA (units * sizeof (int)); \
+ coding->charbuf_size = units; \
} while (0)
-
static void
produce_annotation (struct coding_system *coding, ptrdiff_t pos)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117502: * coding.c (ALLOC_CONVERSION_WORK_AREA): Prefer ptrdiff_t to int and,
Dmitry Antipov <=