|Subject:||stack overflow in the PDF::API2|
|Date:||Tue, 18 Nov 2008 16:23:37 -0800|
|From:||"Sergei Fetisov" <email@example.com>|
We are using the PDF::API2 package with ActiveState Perl 5.8 under Windows XP/2003.
This is an extremely helpful package. Unfortunately, recently I found an issue.
There is a non optimized regular expression at PDF::API2::Basic::PDF::File package, line 648:
$str =~ /^((?:[^\\()]|\\[^()])*)(.*)/so;
Perl5.8 has a recursion code in the regexp engine.
The pattern could contain of a huge number of matches and invoke a deep recursion.
So the regular expression engine is running out of stack space and it causes segmentation fault.
For example, it happens when PDF file contains of the really big metadata (e.g. 30000 characters in the Keywords field).
I think the next regular expression could be used instead and it should resolve the issue:
$str =~ /^(\\?[^\\()]+)(.*)/so;
We are going to update the Perl version up to 5.10 in the future and it has to fix the problem too.
In the meanwhile, we would like to let you know about the issue and it will be great if you have a chance to fix it.
Senior Member of Technical Staff
Stratify, an Iron Mountain Company
501 Ellis Street
Mountain View, CA 94043
The information contained in this email message and its attachments is intended only for the private and confidential use of the recipient(s) named above, unless the sender expressly agrees otherwise. Transmission of email over the Internet is not a secure communications medium. If you are requesting or have requested the transmittal of personal data, as defined in applicable privacy laws by means of email or in an attachment to email you must select a more secure alternate means of transmittal that supports your obligations to protect such personal data. If the reader of this message is not the intended recipient and/or you have received this email in error, you must take no action based on the information in this email and you are hereby notified that any dissemination, misuse, copying, or disclosure of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by email and delete the original message.