Commit 659559af authored by Ken Martin's avatar Ken Martin
Browse files

fix(OpenGL): fix resampling of very large textures

When resizing, the memory alloc for textures with more than
4 Gig samples was overflowing int. Switch to size_t
parent ea8b16d3
Pipeline #224707 running with stage
......@@ -476,7 +476,9 @@ unsigned char* vtkOpenGLTexture::ResampleToPowerOfTwo(
double hx = xsize > 1 ? (xs - 1.0) / (xsize - 1.0) : 0;
double hy = ysize > 1 ? (ys - 1.0) / (ysize - 1.0) : 0;
tptr = p = new unsigned char[xsize * ysize * bpp];
// make sure to promote the size calc to size_t as int can easily overflow
tptr = p = new unsigned char[static_cast<size_t>(xsize) * static_cast<size_t>(ysize) *
static_cast<size_t>(bpp)];
// Resample from the previous image. Compute parametric coordinates and
// interpolate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment