Skip to content

Commit 62f37f3

Browse files
author
RedEnchilada
committed
Limit avatar upload dimensions to reduce PHP out-of-memory errors hopefully?
1 parent 583ba9c commit 62f37f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

actions/avatarsettings.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ function uploadAvatar()
362362

363363
$imagefile = new ImageFile(null, $temp_file_name);
364364
}
365+
366+
if ($imagefile->width * $imagefile->height > 3000*3000) { // guesstimated sane limit
367+
$imagefile->unlink();
368+
369+
$this->showForm(_('File is too big for our servers to process. (Maximum image dimensions should be 9000000 square pixels, or around 3000x3000.)'));
370+
return;
371+
}
365372

366373
$cur = common_current_user();
367374
$type = $imagefile->preferredType();

0 commit comments

Comments
 (0)