unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8238: possibly uninitialized variable in gif_load
@ 2011-03-13  7:17 Paul Eggert
  2011-03-13 10:27 ` Julien Danjou
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2011-03-13  7:17 UTC (permalink / raw)
  To: 8238; +Cc: Julien Danjou

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.





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

* bug#8238: possibly uninitialized variable in gif_load
  2011-03-13  7:17 bug#8238: possibly uninitialized variable in gif_load Paul Eggert
@ 2011-03-13 10:27 ` Julien Danjou
  2011-03-13 17:43   ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Danjou @ 2011-03-13 10:27 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

On Sun, Mar 13 2011, Paul Eggert wrote:

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

Yeah, this should be the good fix AFAICS.

-- 
Julien Danjou
❱ http://julien.danjou.info

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* bug#8238: possibly uninitialized variable in gif_load
  2011-03-13 10:27 ` Julien Danjou
@ 2011-03-13 17:43   ` Paul Eggert
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2011-03-13 17:43 UTC (permalink / raw)
  To: Julien Danjou; +Cc: 8238-done

On 03/13/2011 03:27 AM, Julien Danjou wrote:

> Yeah, this should be the good fix AFAICS.

OK, thanks, I committed that as part of the merge to the
trunk in bzr 103644.





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

end of thread, other threads:[~2011-03-13 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-13  7:17 bug#8238: possibly uninitialized variable in gif_load Paul Eggert
2011-03-13 10:27 ` Julien Danjou
2011-03-13 17:43   ` Paul Eggert

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