summaryrefslogtreecommitdiff
path: root/core/cowdata.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/cowdata.h')
-rw-r--r--core/cowdata.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/cowdata.h b/core/cowdata.h
index 6a8f644d53..54ece4c856 100644
--- a/core/cowdata.h
+++ b/core/cowdata.h
@@ -31,8 +31,8 @@
#ifndef COWDATA_H_
#define COWDATA_H_
-#include "os/memory.h"
-#include "safe_refcount.h"
+#include "core/os/memory.h"
+#include "core/safe_refcount.h"
template <class T>
class Vector;
@@ -87,7 +87,10 @@ private:
#if defined(_add_overflow) && defined(_mul_overflow)
size_t o;
size_t p;
- if (_mul_overflow(p_elements, sizeof(T), &o)) return false;
+ if (_mul_overflow(p_elements, sizeof(T), &o)) {
+ *out = 0;
+ return false;
+ }
*out = next_power_of_2(o);
if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
return true;