mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
fixed two possible int-overflows
This commit is contained in:
parent
a24ad0b597
commit
b4eda85bfc
@ -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;
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user