Skip to content

Commit

Permalink
[Intl] Fixed directory traversal in emoji compression tool
Browse files Browse the repository at this point in the history
When using the compression tool, the emoji data is not compressed properly due to directory traversal issues. It only goes one level deep in the `data' directory.
  • Loading branch information
rlandgrebe committed Jul 20, 2023
1 parent 8fa1634 commit 1f8cb14
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Resources/bin/compress
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ if (!extension_loaded('zlib')) {
throw new Exception('This script requires the zlib extension.');
}

foreach (glob(dirname(__DIR__).'/data/*/*.php') as $file) {
if ('meta.php' === basename($file)) {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(
dirname(__DIR__).'/data',
FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS
)
);

foreach ($iterator as $file) {
if ('php' !== $file->getExtension() || 'meta.php' === $file->getFilename()) {
continue;
}

Expand Down

0 comments on commit 1f8cb14

Please sign in to comment.