From ab81c977537ce1cded5886e67287bb0e8b9e25ce Mon Sep 17 00:00:00 2001 From: ulatekh Date: Sun, 15 Jul 2018 09:05:30 -0700 Subject: [PATCH 1/3] Fixed possible uninitialized variable in HtmlFont copy constructor. Fixed possible dangling reference in HtmlFont assignment operator. --- utils/HtmlFonts.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc index 250909b3..97478c3c 100644 --- a/utils/HtmlFonts.cc +++ b/utils/HtmlFonts.cc @@ -168,7 +168,7 @@ HtmlFont::HtmlFont(const HtmlFont& x){ bold=x.bold; pos=x.pos; color=x.color; - if (x.FontName) FontName=new GooString(x.FontName); + FontName = (x.FontName) ? new GooString(x.FontName) : nullptr; rotOrSkewed = x.rotOrSkewed; memcpy(rotSkewMat, x.rotSkewMat, sizeof(rotSkewMat)); } @@ -187,7 +187,7 @@ HtmlFont& HtmlFont::operator=(const HtmlFont& x){ pos=x.pos; color=x.color; if (FontName) delete FontName; - if (x.FontName) FontName=new GooString(x.FontName); + FontName = (x.FontName) ? new GooString(x.FontName) : nullptr; return *this; } -- 2.14.4