8000 [HttpKernel] Guard against bad profile data by nicolas-grekas · Pull Request #45610 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] Guard against bad profile data #45610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[HttpKernel] Guard against bad profile data
  • Loading branch information
nicolas-grekas committed Mar 2, 2022
commit f4a208915ef1e0e7d6eee72653d04c52cf7b261f
12 changes: 10 additions & 2 deletions src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ public function read($token): ?Profile
$file = 'compress.zlib://'.$file;
}

return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
if (!$data = unserialize(file_get_contents($file))) {
return null;
}

return $this->createProfileFromData($token, $data);
}

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

$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
if (!$childData = unserialize(file_get_contents($file))) {
continue;
}

$profile->addChild($this->createProfileFromData($token, $childData, $profile));
}

return $profile;
Expand Down
0