From 24ea7a8c685fa050b74d7256d32c58809f5bedc1 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 24 Mar 2021 11:38:48 +0100 Subject: [PATCH] check for valid data stream when reading PagedArray --- modules/db/src/paged_array.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/db/src/paged_array.hh b/modules/db/src/paged_array.hh index 776754bc7..3ce76378b 100644 --- a/modules/db/src/paged_array.hh +++ b/modules/db/src/paged_array.hh @@ -135,7 +135,10 @@ public: p.reserve(P); p.resize(left); in_stream.read(reinterpret_cast<char*>(&p.front()), - p.size()*sizeof(T)); + p.size()*sizeof(T)); + if(!in_stream.good()) { + throw ost::Error("Failed to read data!"); + } } } else { throw ost::Error("Cannot load non POD paged array!"); -- GitLab