all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8229: possibly uninitialized variable in load_charset
@ 2011-03-11  0:24 Paul Eggert
  2011-03-23 23:19 ` bug#8229: committed the workaround Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2011-03-11  0:24 UTC (permalink / raw)
  To: 8229

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.





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

end of thread, other threads:[~2021-06-02 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11  0:24 bug#8229: possibly uninitialized variable in load_charset Paul Eggert
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

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.