Ensure limitInputPixels check uses 64-bit unsigned type

This commit is contained in:
Lovell Fuller 2019-04-20 17:51:19 +01:00
parent af7caa7b25
commit 3be4d5bb45

View File

@ -75,7 +75,8 @@ class PipelineWorker : public Nan::AsyncWorker {
// Limit input images to a given number of pixels, where pixels = width * height // Limit input images to a given number of pixels, where pixels = width * height
// Ignore if 0 // Ignore if 0
if (baton->limitInputPixels > 0 && image.width() * image.height() > baton->limitInputPixels) { if (baton->limitInputPixels > 0 &&
static_cast<uint64_t>(image.width() * image.height()) > static_cast<uint64_t>(baton->limitInputPixels)) {
(baton->err).append("Input image exceeds pixel limit"); (baton->err).append("Input image exceeds pixel limit");
return Error(); return Error();
} }