From: Paul Eggert <eggert@cs.ucla.edu>
To: 8229@debbugs.gnu.org
Subject: bug#8229: possibly uninitialized variable in load_charset
Date: Thu, 10 Mar 2011 16:24:13 -0800 [thread overview]
Message-ID: <4D796BAD.3060400@cs.ucla.edu> (raw)
Severity: minor
I found this problem by compiling Emacs with GCC's -Wuninitialized flag.
The following code in the Emacs trunk src/charset.c's load_charset
function is suspicious, because as written it appears that it might be
using an uninitialized variable:
if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP)
map = CHARSET_MAP (charset);
else if (CHARSET_UNIFIED_P (charset))
map = CHARSET_UNIFY_MAP (charset);
if (STRINGP (map))
...
The last if-test uses "map", but it's not clear from the previous
tests that "map" must be initialized.
I'm filing a bug report so that someone who is more expert in this
code can take a look at it. In the meantime, I plan to work around
the problem by replacing:
else if (CHARSET_UNIFIED_P (charset))
map = CHARSET_UNIFY_MAP (charset);
with:
else
{
if (! CHARSET_UNIFIED_P (charset))
abort ();
map = CHARSET_UNIFY_MAP (charset);
}
I'm CC'ing this to Kenichi Handa, who committed the code in question.
next reply other threads:[~2011-03-11 0:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 0:24 Paul Eggert [this message]
2011-03-23 23:19 ` bug#8229: committed the workaround Paul Eggert
2021-06-02 8:03 ` bug#8215: bug#8229: possibly uninitialized variable in load_charset Lars Ingebrigtsen
2021-06-02 12:50 ` bug#8229: " Eli Zaretskii
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=4D796BAD.3060400@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=8229@debbugs.gnu.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).