[Poppler-bugs] [Bug 17676] New: Uninitialized variable in HtmlFont.cc causes segfault

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Sep 20 05:21:09 PDT 2008


http://bugs.freedesktop.org/show_bug.cgi?id=17676

           Summary: Uninitialized variable in HtmlFont.cc causes segfault
           Product: poppler
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
        AssignedTo: poppler-bugs at lists.freedesktop.org
        ReportedBy: tomasare at gmail.com


The pos variable in HtmlFont may not be initialized in the
HtmlFont::HtmlFont(GooString* ftname,int _size, GfxRGB rgb) constructor, if
fontname is set to NULL. This may cause a segfault e.g. in
HtmlFont::isEqualIgnoreBold().

diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index 3598e7f..38bafe5 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -132,7 +132,10 @@ HtmlFont::HtmlFont(GooString* ftname,int _size, GfxRGB
rgb){
     pos=i;
     delete fontname;
   }  
-  if (!DefaultFont) DefaultFont=new GooString(fonts[font_num].name);
+  if (!DefaultFont) {
+    pos = font_num;
+    DefaultFont=new GooString(fonts[pos].name);
+  }

 }


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list