From: David Fussner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 52438@debbugs.gnu.org
Subject: bug#52438: 29.0.50; [PATCH] Fix off-by-one error in etags.c TeX support
Date: Sun, 12 Dec 2021 10:22:25 +0000 [thread overview]
Message-ID: <CADF+Rtj+jWJTwRzzsqgUfn2fgGJFdFbkRpyYOqTpojLy3NOKkQ@mail.gmail.com> (raw)
In-Reply-To: <87lf0qfkh4.fsf@gnus.org>
Hi Lars,
> I'm not able to reproduce the issue on my 64-bit Debian system, but
> reading the code, I think your analysis of the problem sounds correct.
> The patch seemed slightly confusing, though, so I rewrote it a bit.
> Could you check whether this version also fixes the problem?
If my code was merely confusing and inelegant rather than flat-out
incorrect then that's a triumph :-)
> diff --git a/lib-src/etags.c b/lib-src/etags.c
> index bd4d4fcf53..ba66eeede4 100644
> --- a/lib-src/etags.c
> +++ b/lib-src/etags.c
> @@ -5773,7 +5773,7 @@ TeX_commands (FILE *inf)
> TEX_decode_env (const char *evarname, const char *defenv)
> {
> const char *env, *p;
> - ptrdiff_t len;
> + ptrdiff_t len = 1;
>
> /* Append default string to environment. */
> env = getenv (evarname);
> @@ -5782,8 +5782,13 @@ TEX_decode_env (const char *evarname, const char *defenv)
> else
> env = concat (env, defenv, "");
>
> + /* If the environment variable starts with a colon, increase the
> + length of the token table. */
> + if (!strneq (env, ":", 1))
> + len++;
> +
> /* Allocate a token table */
> - for (len = 1, p = env; (p = strchr (p, ':')); )
> + for (p = env; (p = strchr (p, ':')); )
> if (*++p)
> len++;
> TEX_toktab = xnew (len, linebuffer);
>
That fixes the issue here, thank you very much! ( I guess Andreas'
comment on my strneq test is well-founded, though?)
Please close this bug if/when you apply your fix.
David.
next prev parent reply other threads:[~2021-12-12 10:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-11 18:50 bug#52438: 29.0.50; [PATCH] Fix off-by-one error in etags.c TeX support David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-12 5:41 ` Lars Ingebrigtsen
2021-12-12 8:49 ` Andreas Schwab
2021-12-12 10:22 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-12-12 10:26 ` Lars Ingebrigtsen
2021-12-12 10:29 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-12 10:35 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-12 10:42 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-12 10:45 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADF+Rtj+jWJTwRzzsqgUfn2fgGJFdFbkRpyYOqTpojLy3NOKkQ@mail.gmail.com \
--to=bug-gnu-emacs@gnu.org \
--cc=52438@debbugs.gnu.org \
--cc=dfussner@googlemail.com \
--cc=larsi@gnus.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.