unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53333: Fix for crash in ebrowse
@ 2022-01-17 22:35 Jan Stranik via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-18 18:09 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stranik via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-17 22:35 UTC (permalink / raw)
  To: 53333

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

Hello --

attached is a patch to ebrowse. Noticed a one-off write error in case of
identifiers that are too long and need escaping. The patch prevents the
write to memory outside of allocated range which on my platform caused
segfault.

Best,



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ebrowse-emacs-27.2-fix.diff --]
[-- Type: text/x-diff, Size: 974 bytes --]

Dont crash on C source code (one off error)

The fix avoids one off error in case the last character in the buffer
needs to be escaped but there is not enough space in buffer to perform
the escape.

The change just simiply ignores the character in such case.

Author: Jan Stranik <jan@stranik.org>


*** /var/home/janstranik/src/emacs-27.2/lib-src/ebrowse.c~	2021-01-28 11:52:16.000000000 -0600
--- /var/home/janstranik/src/emacs-27.2/lib-src/ebrowse.c	2021-09-24 09:31:49.136287028 -0500
***************
*** 1924,1931 ****
      {
        *--s = *--t;
  
!       if (*s == '"' || *s == '\\')
!         *--s = '\\';
      }
  
    *(matching_regexp_end_buf - 1) = '\0';
--- 1924,1937 ----
      {
        *--s = *--t;
  
!       if (*s == '"' || *s == '\\') {
!           if (s > matching_regexp_buffer)
!               *--s = '\\';
!           else {
!               s++;
!               break;
!           }
!       }
      }
  
    *(matching_regexp_end_buf - 1) = '\0';

[-- Attachment #3: Type: text/plain, Size: 18 bytes --]


-- 

Jan Stranik

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-27 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 22:35 bug#53333: Fix for crash in ebrowse Jan Stranik via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-18 18:09 ` Eli Zaretskii
2022-01-19  1:32   ` Jan Stranik via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-20 11:45     ` Eli Zaretskii
2022-01-27 21:20       ` Jan Stranik via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).