From: Andreas Schwab <schwab@linux-m68k.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 8211@debbugs.gnu.org
Subject: bug#8211: uninitialized variable in detect_coding_iso_2022's end-of-composition code
Date: Wed, 09 Mar 2011 23:30:21 +0100 [thread overview]
Message-ID: <m28vwo3p1e.fsf@igel.home> (raw)
In-Reply-To: <4D77BEA3.6070305@cs.ucla.edu> (Paul Eggert's message of "Wed, 09 Mar 2011 09:53:39 -0800")
Paul Eggert <eggert@cs.ucla.edu> writes:
> I found this problem by compiling Emacs with GCC's -Wuninitialized flag.
>
> The following code in the Emacs trunk src/coding.c's
> detect_coding_iso_2022 function apparently uses an uninitialized variable:
>
> ...
> else if (c == '1')
> {
> /* End of composition. */
> if (composition_count < 0
> || composition_count > MAX_COMPOSITION_COMPONENTS)
> /* Invalid */
> break;
> composition_count = -1;
> found |= CATEGORY_MASK_ISO;
> }
> else
> ...
>
> /* We found a valid designation sequence for CHARSET. */
> rejected |= CATEGORY_MASK_ISO_8BIT;
> if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7],
> id))
> found |= CATEGORY_MASK_ISO_7;
>
> The problem is that the "else if (c == '1')" branch does not initialize
> the local variable "id", but the second "if" test uses that variable.
I think it just lacks a break. ESC '1' is not a designation sequence.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2011-03-09 22:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-09 17:53 bug#8211: uninitialized variable in detect_coding_iso_2022's end-of-composition code Paul Eggert
2011-03-09 22:30 ` Andreas Schwab [this message]
2019-06-19 0:19 ` Paul Eggert
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=m28vwo3p1e.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=8211@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
/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).