summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r--c++/src/H5DataSet.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 68ddefa..3ee0ec5 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -268,8 +268,10 @@ DataSet::getInMemDataSize() const
}
// Calculate and return the size of the data
- size_t data_size = type_size * num_elements;
- return (data_size);
+ // Note that large datasets can overflow a size_t
+ size_t data_size = type_size * static_cast<size_t>(num_elements);
+
+ return data_size;
}
//--------------------------------------------------------------------------