From 07da4f36876781e90f8fcbbe5b83740200e75477 Mon Sep 17 00:00:00 2001 From: Alex K Date: Mon, 14 Jan 2019 20:11:41 +0200 Subject: [PATCH 1/2] $atom_data_read_buffer_size changed max to min Changed max to min when calculating $atom_data_read_buffer_size, to avoid situation when option_fread_buffer_size * 1024 is bigger than php memory limit. --- getid3/module.audio-video.quicktime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getid3/module.audio-video.quicktime.php b/getid3/module.audio-video.quicktime.php index ad770da8..1705225a 100644 --- a/getid3/module.audio-video.quicktime.php +++ b/getid3/module.audio-video.quicktime.php @@ -38,7 +38,7 @@ public function Analyze() { $offset = 0; $atomcounter = 0; - $atom_data_read_buffer_size = max($this->getid3->option_fread_buffer_size * 1024, ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : 1024)); // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] + $atom_data_read_buffer_size = min($this->getid3->option_fread_buffer_size * 1024, ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : 1024)); // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] while ($offset < $info['avdataend']) { if (!getid3_lib::intValueSupported($offset)) { $this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'); From dbd13a33e1e3da29c9ceada878ddb5e640670e1a Mon Sep 17 00:00:00 2001 From: Alex K Date: Tue, 15 Jan 2019 09:53:57 +0200 Subject: [PATCH 2/2] changed logic to match comment --- getid3/module.audio-video.quicktime.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getid3/module.audio-video.quicktime.php b/getid3/module.audio-video.quicktime.php index 1705225a..3b4fd5bc 100644 --- a/getid3/module.audio-video.quicktime.php +++ b/getid3/module.audio-video.quicktime.php @@ -38,7 +38,7 @@ public function Analyze() { $offset = 0; $atomcounter = 0; - $atom_data_read_buffer_size = min($this->getid3->option_fread_buffer_size * 1024, ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : 1024)); // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] + $atom_data_read_buffer_size = $info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : $this->getid3->option_fread_buffer_size * 1024; // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] while ($offset < $info['avdataend']) { if (!getid3_lib::intValueSupported($offset)) { $this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions');