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); + } }
Patch looks wrong, i'd say the equal needs to be outside the if (!DefaultFont) { Do you agree?
Absolutely, sorry about that. You're thinking of something like this instead? We only need to assign pos if the fontname variable is NULL. diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc index 3598e7f..ed8656c 100644 --- a/utils/HtmlFonts.cc +++ b/utils/HtmlFonts.cc @@ -131,7 +131,8 @@ HtmlFont::HtmlFont(GooString* ftname,int _size, GfxRGB rgb){ } pos=i; delete fontname; - } + } else + pos = font_num; if (!DefaultFont) DefaultFont=new GooString(fonts[font_num].name); }
Fix commited for poppler 0.9.2
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.