Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong /Length calculation in xobjects #723

Open
crThiago opened this issue May 22, 2024 · 0 comments
Open

Wrong /Length calculation in xobjects #723

crThiago opened this issue May 22, 2024 · 0 comments

Comments

@crThiago
Copy link

crThiago commented May 22, 2024

The method _putxobjects calculate the stream length:

1 - $stream = $this->_getrawstream($stream, $data['n']);
2 - $out .= ' /Length '.strlen($stream);
3 - $out .= ' >>';
4 - $out .= ' stream'."\n".$stream."\n".'endstream'; // INCREMENTED MORE BYTES HERE
5 - $out .= "\n".'endobj';
6 - $this->_out($out);

but on line 4 $out .= ' stream'."\n".$stream."\n".'endstream'; is incremented more bytes (\n) resulting in a wrong calculation

Sugestion

Move the break line from line 4 to line 1:

1 - $stream = "\n" . $this->_getrawstream($stream, $data['n']) . "\n";
2 - $out .= ' /Length '.strlen($stream);
3 - $out .= ' >>';
4 - $out .= ' stream' . $stream . 'endstream'; 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant