Skip to content

Conversation

@fancycode
Copy link
Member

@fancycode fancycode commented Dec 16, 2021

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 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 [email protected]

@fancycode fancycode force-pushed the image-memory-limit branch 3 times, most recently from 9d98b3b to 87c4ba5 Compare December 16, 2021 09:40
@solracsf solracsf added the 3. to review Waiting for reviews label Dec 16, 2021
@nickvergessen nickvergessen requested review from a team, come-nc, nickvergessen and skjnldsv and removed request for a team January 3, 2022 14:10
@nickvergessen nickvergessen added this to the Nextcloud 24 milestone Jan 3, 2022
@skjnldsv
Copy link
Member

Hey @fancycode , could you address the comments ? :)
Happy new year! 🎉

@fancycode
Copy link
Member Author

Hey @fancycode , could you address the comments ? :) Happy new year! tada

Happy new year to you, too. I just came back from vacation today and are going through my inbox. Will address the comments as soon as possible.

@fancycode
Copy link
Member Author

All comments addressed. Commits should be squashed and the text of the first commit should be adjusted (limit is now read from config.php instead of the app config) - I can do this before merging.

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 <[email protected]>
@fancycode
Copy link
Member Author

Commits are squashed and the message is updated, so this is ready to merge from my side.

@blizzz blizzz added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 11, 2022
@nickvergessen nickvergessen merged commit c47406a into master Jan 11, 2022
@nickvergessen nickvergessen deleted the image-memory-limit branch January 11, 2022 12:35
@fancycode
Copy link
Member Author

Thanks for merging. Probably would be good to also backport this change to all versions that still receive security updates.

@nickvergessen
Copy link
Member

/backport to stable23

@nickvergessen
Copy link
Member

/backport to stable22

@nickvergessen
Copy link
Member

/backport to stable21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish bug feature: previews and thumbnails

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants