unofficial mirror of bug-gnu-emacs@gnu.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

* bug#8229: committed the workaround
  2011-03-11  0:24 bug#8229: possibly uninitialized variable in load_charset Paul Eggert
@ 2011-03-23 23:19 ` Paul Eggert
  2021-06-02  8:03   ` bug#8215: bug#8229: possibly uninitialized variable in load_charset Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2011-03-23 23:19 UTC (permalink / raw)
  To: 8229, 8215, 8211

I committed my abovementioned workaround into the
Emacs trunk on 2011-03-11 (bzr 103589).  I don't
consider this a fix, though, so I'm leaving this
bug report open.





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

* bug#8215: bug#8229: possibly uninitialized variable in load_charset
  2011-03-23 23:19 ` bug#8229: committed the workaround Paul Eggert
@ 2021-06-02  8:03   ` Lars Ingebrigtsen
  2021-06-02 12:50     ` bug#8229: " Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-02  8:03 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 8211, 8229, 8215

Paul Eggert <eggert@cs.ucla.edu> writes:

> I committed my abovementioned workaround into the
> Emacs trunk on 2011-03-11 (bzr 103589).  I don't
> consider this a fix, though, so I'm leaving this
> bug report open.

This was ten years ago:

commit 0ac2c2991c1cba4e3c6e5f7b62c7d61b01d69994
Author:     Paul Eggert <eggert@cs.ucla.edu>
AuthorDate: Mon Mar 7 16:46:23 2011 -0800
Commit:     Paul Eggert <eggert@cs.ucla.edu>
CommitDate: Mon Mar 7 16:46:23 2011 -0800

    * charset.c (load_charset): Abort instead of using uninitialized var.

The code is still pretty much identical, as far as I can tell.  Should
this report be closed now?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#8229: bug#8215: bug#8229: possibly uninitialized variable in load_charset
  2021-06-02  8:03   ` bug#8215: bug#8229: possibly uninitialized variable in load_charset Lars Ingebrigtsen
@ 2021-06-02 12:50     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-06-02 12:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 8229-done, eggert

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 02 Jun 2021 10:03:14 +0200
> Cc: 8211@debbugs.gnu.org, 8229@debbugs.gnu.org, 8215@debbugs.gnu.org
> 
> Paul Eggert <eggert@cs.ucla.edu> writes:
> 
> > I committed my abovementioned workaround into the
> > Emacs trunk on 2011-03-11 (bzr 103589).  I don't
> > consider this a fix, though, so I'm leaving this
> > bug report open.
> 
> This was ten years ago:
> 
> commit 0ac2c2991c1cba4e3c6e5f7b62c7d61b01d69994
> Author:     Paul Eggert <eggert@cs.ucla.edu>
> AuthorDate: Mon Mar 7 16:46:23 2011 -0800
> Commit:     Paul Eggert <eggert@cs.ucla.edu>
> CommitDate: Mon Mar 7 16:46:23 2011 -0800
> 
>     * charset.c (load_charset): Abort instead of using uninitialized var.
> 
> The code is still pretty much identical, as far as I can tell.  Should
> this report be closed now?

I'm closing it.  I think non-unified charsets are rarely if ever used
in Emacs these days, but in any case, we have emacs_abort there, so if
the problem ever rears its ugly head, we will catch it.





^ 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 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).