emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#8211: closed (uninitialized variable in detect_cod


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#8211: closed (uninitialized variable in detect_coding_iso_2022's end-of-composition code)
Date: Wed, 19 Jun 2019 00:20:02 +0000

Your message dated Tue, 18 Jun 2019 17:19:03 -0700
with message-id <address@hidden>
and subject line Re: uninitialized variable in detect_coding_iso_2022's 
end-of-composition code
has caused the debbugs.gnu.org bug report #8211,
regarding uninitialized variable in detect_coding_iso_2022's end-of-composition 
code
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
8211: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8211
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: uninitialized variable in detect_coding_iso_2022's end-of-composition code Date: Wed, 09 Mar 2011 09:53:39 -0800 User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7
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 plan to work around the uninitialized-variable problem by initializing
"id" to zero.  This will replace undefined behavior with defined behavior,
so it shouldn't introduce a new bug, but it probably doesn't fix the
bug in question, assuming there is one.  Could an expert in this
area please review this and come up with a real fix?

I'm CC'ing this to Kenichi Handa, who committed the code in question.



--- End Message ---
--- Begin Message --- Subject: Re: uninitialized variable in detect_coding_iso_2022's end-of-composition code Date: Tue, 18 Jun 2019 17:19:03 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0
Kenichi Handa evidently fixed this old bug in 2011 after I filed it, so I'm 
closing the bug report now.



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]