8000 bug #45610 [HttpKernel] Guard against bad profile data (nicolas-grekas) · symfony/symfony@6ef994c · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ef994c

Browse files
bug #45610 [HttpKernel] Guard against bad profile data (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpKernel] Guard against bad profile data | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #45606 | License | MIT | Doc PR | - Commits ------- f4a2089 [HttpKernel] Guard against bad profile data
2 parents d4150be + f4a2089 commit 6ef994c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ public function read($token): ?Profile
123123
$file = 'compress.zlib://'.$file;
124124
}
125125

126-
return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
126+
if (!$data = unserialize(file_get_contents($file))) {
127+
return null;
128+
}
129+
130+
return $this->createProfileFromData($token, $data);
127131
}
128132

129133
/**
@@ -297,7 +301,11 @@ protected function createProfileFromData($token, $data, $parent = null)
297301
$file = 'compress.zlib://'.$file;
298302
}
299303

300-
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
304+
if (!$childData = unserialize(file_get_contents($file))) {
305+
continue;
306+
}
307+
308+
$profile->addChild($this->createProfileFromData($token, $childData, $profile));
301309
}
302310

303311
return $profile;

0 commit comments

Comments
 (0)
0