[poppler] [PATCH] nGfxBlendModeNames has incorrect size

Krzysztof Kowalczyk kkowalczyk at gmail.com
Sat Jul 29 19:32:41 PDT 2006


Hello,

Attached is a patch that sets a correct size (17) for
nGfxBlendModeNames instead of incorrect 34 (the current value).

Incorrect size will cause accessing invalid memory when traversing the
gfxBlendModeNames array in GfxState::parseBlendMode().

This is filed as bug 7688 (https://bugs.freedesktop.org/show_bug.cgi?id=7688).

Regards,

-- kjk (http://blog.kowalczyk.info)
-------------- next part --------------
Index: GfxState.cc
===================================================================
--- GfxState.cc	(revision 23)
+++ GfxState.cc	(working copy)
@@ -62,10 +62,12 @@
 
 //------------------------------------------------------------------------
 
+#define nGfxBlendModeNames 17
+
 static struct {
  char *name;
  GfxBlendMode mode;
-} gfxBlendModeNames[] = {
+} gfxBlendModeNames[nGfxBlendModeNames] = {
   { "Normal",     gfxBlendNormal },
   { "Compatible", gfxBlendNormal },
   { "Multiply",   gfxBlendMultiply },
@@ -84,9 +86,6 @@
   { "Color",      gfxBlendColor },
   { "Luminosity", gfxBlendLuminosity }
 };
-
-#define nGfxBlendModeNames \
-          ((int)((sizeof(gfxBlendModeNames) / sizeof(char *))))
 	 
 //------------------------------------------------------------------------
 // 


More information about the poppler mailing list