From 44d49575485375cacabe734feaf47cf367e21478 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 1f640ac5ff..a18fddcbde 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -1086,6 +1086,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) {