]> source.dussan.org Git - nextcloud-server.git/commit
Prevent loading images that would require too much memory. 30291/head
authorJoachim Bauch <bauch@struktur.de>
Thu, 16 Dec 2021 08:17:11 +0000 (09:17 +0100)
committerJoachim Bauch <bauch@struktur.de>
Tue, 11 Jan 2022 10:44:38 +0000 (11:44 +0100)
commitd3d65e5c889fc3922efc7a8c764027763bc4764f
tree4f7532e41f445c18759dafccd6f22d71d04bf4ea
parent55219acb4e964863b301028d47a496fa5d235456
Prevent loading images that would require too much memory.

For most image formats, the header specifies the width/height.
PHP allocates an image object from that size, even if the actual
image data is much smaller. This image object size is not limited
by the limit configured in PHP.

The memory limit can be configured through "config.php" setting
"preview_max_memory" and defaults to 128 MBytes which should be
enough for most images without filling up all memory.

Signed-off-by: Joachim Bauch <bauch@struktur.de>
config/config.sample.php
lib/private/legacy/OC_Image.php
tests/data/testimage-badheader.jpg [new file with mode: 0644]
tests/lib/ImageTest.php