all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: 8238@debbugs.gnu.org
Cc: Julien Danjou <julien@danjou.info>
Subject: bug#8238: possibly uninitialized variable in gif_load
Date: Sat, 12 Mar 2011 23:17:25 -0800	[thread overview]
Message-ID: <4D7C6F85.3060806@cs.ucla.edu> (raw)

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	other threads:[~2011-03-13  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-13  7:17 Paul Eggert [this message]
2011-03-13 10:27 ` bug#8238: possibly uninitialized variable in gif_load Julien Danjou
2011-03-13 17:43   ` Paul Eggert

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D7C6F85.3060806@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=8238@debbugs.gnu.org \
    --cc=julien@danjou.info \
    /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 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.