Skip to content

Commit 9d1d50a

Browse files
committed
Merge branch '1.x' into 2.x
2 parents 2532e5e + 93d5b1c commit 9d1d50a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Engine/Decoder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function processChar(): void
8989
private function readInteger(string $delimiter): string|false
9090
{
9191
$pos = ftell($this->stream);
92-
$readLength = 64;
92+
$readLength = 32; // More than enough for 64 bit int (19 digits + minus + delimiter)
9393

9494
do {
9595
fseek($this->stream, $pos, SEEK_SET);
@@ -104,7 +104,8 @@ private function readInteger(string $delimiter): string|false
104104
return $int;
105105
}
106106

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

110111
return false;

0 commit comments

Comments
 (0)