summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-05-02 02:34:14 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-05-02 03:19:44 +1000
commite97f19e96c094457ba98e3f89195cad4d814e8a3 (patch)
tree3887fabac7847d6e0180a350ec455f20acb8437a /vcl
parent4b7bdef4b1d1e4ff45a8816c038df38ce7995b3d (diff)
coverity#441827 Deference before null check
In OutputDevice::ImplGlyphFallbackLayout we should check to ensure that mpFontEntry is valid, if not then return NULL early. Change-Id: I946aa4d724a73a2ff85a4281c0df5f75e12104f7
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/font.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index e9ae02e07644..78f82043b4df 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -2029,6 +2029,16 @@ SalLayout* OutputDevice::getFallbackFont(ImplFontEntry &rFallbackFont,
SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLayoutArgs& rLayoutArgs ) const
{
+ // This function relies on a valid mpFontEntry, if it doesn't exist bail out
+ // - we'd have crashed later on anyway. At least here we can catch the error in debug
+ // mode.
+ if ( !mpFontEntry )
+ {
+ SAL_WARN ("vcl.gdi", "No font entry set in OutputDevice");
+ assert(mpFontEntry);
+ return NULL;
+ }
+
// prepare multi level glyph fallback
MultiSalLayout* pMultiSalLayout = NULL;
ImplLayoutRuns aLayoutRuns = rLayoutArgs.maRuns;
@@ -2062,7 +2072,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
aFontSelData.mpFontEntry = pFallbackFont;
aFontSelData.mpFontData = pFallbackFont->maFontSelData.mpFontData;
- if( mpFontEntry && nFallbackLevel < MAX_FALLBACK-1)
+ if( nFallbackLevel < MAX_FALLBACK-1)
{
// ignore fallback font if it is the same as the original font
if( mpFontEntry->maFontSelData.mpFontData == aFontSelData.mpFontData )