aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Preview/Generator.php
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-05-17 00:14:42 +0200
committerGitHub <noreply@github.com>2023-05-17 00:14:42 +0200
commit6608f84a461223696810f4568c3f871d9b5209b8 (patch)
treed5b8475d54a891b2cb5d79feac08b2e743dd370f /lib/private/Preview/Generator.php
parentf01d30ad1178b04d9e44250679775fb285c7f7a0 (diff)
parente60888d98892be22477ea6ace68255d7202dbec8 (diff)
downloadnextcloud-server-6608f84a461223696810f4568c3f871d9b5209b8.tar.gz
nextcloud-server-6608f84a461223696810f4568c3f871d9b5209b8.zip
Merge pull request #36692 from nextcloud/throw-exception-to-avoid-division-by-zero
fix(preview-generator): Throw exception before dividing by zero when generating previews
Diffstat (limited to 'lib/private/Preview/Generator.php')
-rw-r--r--lib/private/Preview/Generator.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index d19f5d29bf5..9711192d740 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -172,6 +172,10 @@ class Generator {
[$maxWidth, $maxHeight] = $this->getPreviewSize($maxPreview, $previewVersion);
+ if ($maxWidth <= 0 || $maxHeight <= 0) {
+ throw new NotFoundException('The maximum preview sizes are zero or less pixels');
+ }
+
$preview = null;
foreach ($specifications as $specification) {