[poppler] splash/SplashScreen.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Sep 5 22:09:54 UTC 2016


 splash/SplashScreen.cc |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 1de363eecfa50f6432c5ff87c920213186815416
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Sep 6 00:09:40 2016 +0200

    Fix another ubsan warning

diff --git a/splash/SplashScreen.cc b/splash/SplashScreen.cc
index 68ccd7d..9b0a267 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 at kde.org>
+// Copyright (C) 2009, 2016 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at 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;
 }


More information about the poppler mailing list