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

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

bug#8238: possibly uninitialized variable in gif_load


From: Paul Eggert
Subject: bug#8238: possibly uninitialized variable in gif_load
Date: Sat, 12 Mar 2011 23:17:25 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

I found this problem by code inspection.

The following code in the Emacs trunk src/image.c's gif_load
function is suspicious, because it uses a variable transparent_p
that appears to be uninitialized in some cases:

  boolean transparent_p;
  ...
  for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++)
    if ((gif->SavedImages[ino].ExtensionBlocks[i].Function
         == GIF_LOCAL_DESCRIPTOR_EXTENSION)
        && gif->SavedImages[ino].ExtensionBlocks[i].ByteCount == 4
        /* Transparency enabled?  */
        && gif->SavedImages[ino].ExtensionBlocks[i].Bytes[0] & 1)
      {
        transparent_p = 1;
        ...
      }
  ...
  if (gif_color_map)
    for (i = 0; i < gif_color_map->ColorCount; ++i)
      {
        if (transparent_p && transparency_color_index == i)

The code never sets transparent_p to any value other than 1,
but sometimes transparent_p appears to be uninitialized.

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 initializing the variable to 0.

I'm CC'ing this to Julien Danjou, who committed the code in question.





reply via email to

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