Project

Profile

Help

Bug #3756

closed

Stack overflow in base64_decode()

Added by Debbie Lockett over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2018-04-24
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

Issue raised by user 2018-02-05 via email: stack overflow inside base64_decode() function, when a large data file is supplied.

One step of the work around produced for Bug #3163 uses the internal SaxonJS.U.Atomic.base64Binary.fromString() function to decode a base-64 encoded version of an SEF. SaxonJS.U.Atomic.base64Binary.fromString() calls base64_decode(). The function is used to decode a string of data which has been encoded using base-64 encoding. The output data is represented as a string containing octets/codepoints in the range 0-255.

The user suggested using the native JavaScript base64 decode function atob() rather than our custom version base64_decode(). But the custom version is used because there is an edge-case XPath conformance issue with using atob(), because it is more forgiving of invalid input than the XPath/XSD specification. (Also issues were caused by the non-ASCII character used for the SEF checksum.)

It is suspected that the stack overflow is caused by the large regex at the start of the base64_decode() function.

Please register to edit this issue

Also available in: Atom PDF Tracking page