From ae3d7333608652cc35f1d50cac9ea90b55f12a08 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 22 Mar 2015 10:21:45 +0100 Subject: [PATCH] Backport 20156 fix (stack corruption) Fixes: debbugs:20156 * src/fontset.c (fontset_pattern_regexp): Backport: Replace + 1 with + 3 in alloca (tiny change) --- src/ChangeLog | 5 +++++ src/fontset.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 90908fcf759..060486b4ab3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2015-03-22 John F Carr + + * fontset.c (fontset_pattern_regexp): Backport: Replace + 1 with + + 3 in alloca (Bug#20156) (tiny change) + 2015-03-12 Glenn Morris * frame.h (x_set_bitmap_icon): Don't set the icon if icon-type is diff --git a/src/fontset.c b/src/fontset.c index d9aa99d05f5..5772cc830c8 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1097,9 +1097,9 @@ fontset_pattern_regexp (Lisp_Object pattern) we convert "*" to "[^-]*" which is much faster in regular expression matching. */ if (ndashes < 14) - p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); + p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 3); else - p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); + p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 3); *p1++ = '^'; for (p0 = SDATA (pattern); *p0; p0++) -- 2.39.2