mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
xcf: Do not overflow int on the setDotsPerMeterX/Y call
This commit is contained in:
parent
b8cb5e322c
commit
3dee6f7c47
@ -1432,8 +1432,14 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
||||
break;
|
||||
}
|
||||
|
||||
image.setDotsPerMeterX((int)(xcf_image.x_resolution * INCHESPERMETER));
|
||||
image.setDotsPerMeterY((int)(xcf_image.y_resolution * INCHESPERMETER));
|
||||
const float dpmx = xcf_image.x_resolution * INCHESPERMETER;
|
||||
if (dpmx > std::numeric_limits<int>::max())
|
||||
return false;
|
||||
const float dpmy = xcf_image.y_resolution * INCHESPERMETER;
|
||||
if (dpmy > std::numeric_limits<int>::max())
|
||||
return false;
|
||||
image.setDotsPerMeterX((int)dpmx);
|
||||
image.setDotsPerMeterY((int)dpmy);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user