unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Stranik via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 53333@debbugs.gnu.org
Subject: bug#53333: Fix for crash in ebrowse
Date: Tue, 18 Jan 2022 20:32:55 -0500	[thread overview]
Message-ID: <878rvc1pdk.fsf@stranik.org> (raw)
In-Reply-To: <835yqgvru9.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 18 Jan 2022 20:09:18 +0200")

>
> Thanks, but can you explain the need for this part:
>
>> !           else {
>> !               s++;
>> !               break;
>> !           }
>> !       }
>
> Why do we need to advance the pointer 's' in the 'else' clause? why
> not leave it alone?

The identifier is copied from end to the buffer. As we are copying, we
want to escape quote and backslash characters. Normally if we encounter
any of these characters we just prepend \ to in front. If there is not
enough space in the buffer to insert the \, we should increase the s, to
back-out the character that we wanted to escape.

If we would not do that, the first character might not be escaped. If
that character were a quote, it would break the lisp expressions written
later to the BROWSE file.

> Or maybe I will understand the reason if you show some simple code
> that hits this problem (which would be a good thing of its own, as
> we'd then have a test to add to our test suite)?

I encountered this in a c++ header file with very long identifiers that
just filled the buffer but the first character had to be escaped.

-- 

Jan Stranik





  reply	other threads:[~2022-01-19  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=878rvc1pdk.fsf@stranik.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=53333@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jan@stranik.org \
    /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).