Skip to content

Commit

Permalink
Merge branch '1.x' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
arokettu committed Feb 3, 2021
2 parents 2532e5e + 93d5b1c commit 9d1d50a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Engine/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private function processChar(): void
private function readInteger(string $delimiter): string|false
{
$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 @@ -104,7 +104,8 @@ private function readInteger(string $delimiter): string|false
return $int;
}

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

return false;
Expand Down

0 comments on commit 9d1d50a

Please sign in to comment.