fixed two possible int-overflows

This commit is contained in:
jkriege2 2022-04-21 13:59:49 +02:00
parent a24ad0b597
commit b4eda85bfc
2 changed files with 2 additions and 2 deletions

View File

@ -657,7 +657,7 @@ inline void JKQTPImagePlot_array2RGBimage(const T* dbl_in, int width, int height
T* dbllog=nullptr;
if (logScale) {
double logB=log10(logBase);
dbllog=static_cast<T*>(malloc(width*height*sizeof(T)));
dbllog=static_cast<T*>(malloc(static_cast<size_t>(width)*static_cast<size_t>(height)*sizeof(T)));
//memcpy(dbl, dbl_in, width*height*sizeof(T));
for (int i=0; i<width*height; i++) {
dbllog[i]=log10(dbl_in[i])/logB;

View File

@ -63,7 +63,7 @@ void JKQTPContourPlot::draw(JKQTPEnhancedPainter &painter)
int64_t colChecksum=-1;
if (data && Nx*Ny>0) {
colChecksum=static_cast<int64_t>(qChecksum(reinterpret_cast<const char*>(data), Nx*Ny* getSampleSize()/sizeof(char)));
colChecksum=static_cast<int64_t>(qChecksum(reinterpret_cast<const char*>(data), static_cast<int64_t>(Nx)*static_cast<int64_t>(Ny)* static_cast<int64_t>(getSampleSize()/sizeof(char))));
}
/*if (parent && parent->getDatastore() && imageColumn>=0) {
colChecksum=static_cast<int64_t>(parent->getDatastore()->getColumnChecksum(imageColumn));