From 436cd31bd2a8d94d20367d9b937eb9dc6047be68 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 12 Mar 2021 17:23:02 +0100 Subject: [PATCH] verify that cache entry is valid Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Cache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 71c419bc6fd..44e97f4f3aa 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -1058,6 +1058,9 @@ class Cache implements ICache { * @return int fileid of copied entry */ public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int { + if ($sourceEntry->getId() < 0) { + throw new \RuntimeException("Invalid source cache entry on copyFromCache"); + } $data = $this->cacheEntryToArray($sourceEntry); $fileId = $this->put($targetPath, $data); if ($fileId <= 0) { -- 2.39.5