Skip to content

Commit

Permalink
That was more than exponentially
Browse files Browse the repository at this point in the history
  • Loading branch information
arokettu committed Feb 3, 2021
1 parent af0452c commit 93d5b1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Engine/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private function processChar()
private function readInteger(string $delimiter)
{
$pos = ftell($this->stream);
$readLength = 64;
$readLength = 32; // More than enough for 64 bit int (19 digits + minus + delimiter)

do {
fseek($this->stream, $pos, SEEK_SET);
Expand All @@ -116,7 +116,7 @@ private function readInteger(string $delimiter)
}

fread($this->stream, 1); // trigger feof
$readLength *= $readLength; // grow exponentially
$readLength *= 32; // grow exponentially
} while (!feof($this->stream) && $readLength < PHP_INT_MAX);

return false;
Expand Down

0 comments on commit 93d5b1c

Please sign in to comment.