From 300c4dd6b810207cd2e56f0446813273de4f2d77 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 b7f39df25f..d7495379a3 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -1002,6 +1002,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) {