mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
ImageSource: restrict max dimensions to protect from integer overflows (#15965)
This commit is contained in:
parent
0179021acc
commit
47c75b3294
2 changed files with 19 additions and 8 deletions
|
@ -45,6 +45,12 @@ struct ImageSource {
|
|||
// Insert a source image into the cache without touching the filesystem.
|
||||
void insertSourceImage(const std::string &name, video::IImage *img, bool prefer_local);
|
||||
|
||||
// This was picked so that the image buffer size fits in an s32 (assuming 32bpp).
|
||||
// The exact value is 23170 but this provides some leeway.
|
||||
// In theory something like 33333x123 could be allowed, but there is no strong
|
||||
// need or argument. Irrlicht also has the same limit.
|
||||
static constexpr int MAX_IMAGE_DIMENSION = 23000;
|
||||
|
||||
private:
|
||||
|
||||
// Generate image based on a string like "stone.png" or "[crack:1:0".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue