diff --git a/src/DataVampire.cpp b/src/DataVampire.cpp index 597532fb35c3894ecf3ce66a2cb7c62ed7876cde..57704aef2300eb9345615f077a8539e6b9055b43 100644 --- a/src/DataVampire.cpp +++ b/src/DataVampire.cpp @@ -2031,6 +2031,23 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, __FUNCTION__); } + if (((num_cols * num_rows * num_samples) > val.size()) && (*attr_PostAcqRoi_read == true)) { + Tango::Except::throw_exception ( + (const char *)"Failed to store data", + (const char *)"Data size too large", + __FUNCTION__); + } + + if ((*attr_PostAcqRoi_read == true) && (roi_dim == 4)) { + if ((num_cols * num_rows * num_samples) != (*attr_Width_read * *attr_Height_read * num_samples)) { + Tango::Except::throw_exception ( + (const char *)"Failed to store data", + (const char *)"Width/Height mismatch with image size", + __FUNCTION__); + } + + } + // reallocate buffer if (val.size() != cache_buffer[cache_idx].data_size) { cache_buffer[cache_idx].databuf = (double *)realloc(cache_buffer[cache_idx].databuf, val.size() * sizeof(double));