unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Philipp Stephani <p.stephani2@gmail.com>,
	Jean-Christophe Helary <jean.christophe.helary@gmail.com>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: i18n/l10n summary
Date: Sat, 2 Dec 2017 21:43:28 -0800	[thread overview]
Message-ID: <3c0ffa49-bf6d-1747-b9da-97e3a842e36c@cs.ucla.edu> (raw)
In-Reply-To: <0aec575b-6cbe-bc87-2d54-7de95be5c080@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

I wrote on 2017-06-04:
> Philipp Stephani wrote:
>> It's not hard to fix,
> 
> Thanks. However, on my platform those fixes slowed down a microbenchmark (format 
> "%d %s %c" 3 "def" ?‘) by 7%, so I installed the attached further patch, which 
> recovered the performance loss for me.

Oops, that introduced an off-by-one error that caused Emacs to access one past 
the end of the 'info' array. To fix this I installed the attached further patch 
into emacs-26 and merged emacs-26 into master.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-bug-in-i18n-l10n-optimization.patch --]
[-- Type: text/x-patch; name="0001-Fix-bug-in-i18n-l10n-optimization.patch", Size: 1429 bytes --]

From 04e5b28ff1691345e023a944dc6a6a9e9573bd07 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 2 Dec 2017 21:31:24 -0800
Subject: [PATCH] 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.
---
 src/editfns.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index f275f33..f7c26b9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4919,7 +4919,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
 		  else if (discarded[bytepos] == 1)
 		    {
 		      position++;
-		      if (translated == info[fieldn].start)
+		      if (fieldn < nspec && translated == info[fieldn].start)
 			{
 			  translated += info[fieldn].end - info[fieldn].start;
 			  fieldn++;
@@ -4939,7 +4939,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
 		  else if (discarded[bytepos] == 1)
 		    {
 		      position++;
-		      if (translated == info[fieldn].start)
+		      if (fieldn < nspec && translated == info[fieldn].start)
 			{
 			  translated += info[fieldn].end - info[fieldn].start;
 			  fieldn++;
-- 
2.7.4


  parent reply	other threads:[~2017-12-03  5:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-28  5:29 i18n/l10n summary Jean-Christophe Helary
2017-05-28 14:27 ` Drew Adams
2017-05-28 14:36   ` Jean-Christophe Helary
2017-05-28 15:33   ` Eli Zaretskii
2017-06-05 12:55   ` Jean-Christophe Helary
2017-07-17 23:22     ` Jean-Christophe Helary
2017-07-22 12:48       ` Jean-Christophe Helary
2017-07-22 13:06         ` Eli Zaretskii
2017-07-22 13:45           ` Jean-Christophe Helary
2017-07-22 14:08             ` Eli Zaretskii
2017-07-22 23:54               ` Jean-Christophe Helary
2017-07-23 14:39                 ` Eli Zaretskii
2017-07-23 23:29                   ` Jean-Christophe Helary
2017-07-24 14:47                     ` Eli Zaretskii
2017-07-24 15:34                       ` Jean-Christophe Helary
2017-07-24 15:51                         ` Eli Zaretskii
2017-07-24 16:08                           ` Jean-Christophe Helary
2017-07-24 16:29                             ` Eli Zaretskii
2017-07-24 16:48                               ` Jean-Christophe Helary
2017-07-24 16:55                                 ` Eli Zaretskii
2017-05-31 22:18 ` Philipp Stephani
2017-05-31 22:29   ` Jean-Christophe Helary
2017-06-01  5:18   ` Paul Eggert
2017-06-01  8:17     ` Philipp Stephani
2017-06-01 23:20       ` Paul Eggert
2017-06-02  6:52         ` Philipp Stephani
2017-06-03  8:37           ` Paul Eggert
2017-06-03  9:12             ` Andreas Schwab
2017-06-03  9:34             ` Philipp Stephani
2017-06-04 15:54               ` Paul Eggert
2017-06-04 16:45                 ` Eli Zaretskii
2017-06-04 18:37                   ` Paul Eggert
2017-12-03  5:43                 ` Paul Eggert [this message]
2017-06-01 14:21   ` Eli Zaretskii
2017-07-02  1:22   ` Jean-Christophe Helary
2017-07-02  2:34     ` Eli Zaretskii
2017-07-28  0:15 ` Byung-Hee HWANG (황병희, 黃炳熙)
2018-04-25 12:58 ` Jean-Christophe Helary
2018-09-21  4:18   ` Jean-Christophe Helary
     [not found] <<AA86315D-1561-41EB-A349-63100C565E8D@gmail.com>
     [not found] ` <<0aca6c65-4610-44c2-99c4-6cbe7aa68c9a@default>
     [not found]   ` <<83a85xgfo2.fsf@gnu.org>
2017-05-28 21:52     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c0ffa49-bf6d-1747-b9da-97e3a842e36c@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jean.christophe.helary@gmail.com \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).