summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2016-09-06 00:09:40 +0200
committerAlbert Astals Cid <aacid@kde.org>2016-09-06 00:09:40 +0200
commit1de363eecfa50f6432c5ff87c920213186815416 (patch)
tree9dd7b67a642c656e95076bfc39fee7bbb3d01196
parent90d0fae2b0bd713f36500f59f4bfee33ad9e13bb (diff)
Fix another ubsan warning
-rw-r--r--splash/SplashScreen.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/splash/SplashScreen.cc b/splash/SplashScreen.cc
index 68ccd7dd..9b0a2678 100644
--- a/splash/SplashScreen.cc
+++ b/splash/SplashScreen.cc
@@ -11,7 +11,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2009, 2016 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
//
// To see a description of the changes please see the Changelog file that
@@ -30,6 +30,7 @@
#include <algorithm>
#include "goo/gmem.h"
#include "goo/grandom.h"
+#include "goo/GooLikely.h"
#include "SplashMath.h"
#include "SplashScreen.h"
@@ -377,7 +378,9 @@ SplashScreen::SplashScreen(SplashScreen *screen) {
sizeM1 = screen->sizeM1;
log2Size = screen->log2Size;
mat = (Guchar *)gmallocn(size * size, sizeof(Guchar));
- memcpy(mat, screen->mat, size * size * sizeof(Guchar));
+ if (likely(mat)) {
+ memcpy(mat, screen->mat, size * size * sizeof(Guchar));
+ }
minVal = screen->minVal;
maxVal = screen->maxVal;
}