I've encountered an issue with the substring() function in the antchfx/xpath package. According to the XPath specification, if the length parameter exceeds the actual remaining length of the string, the function should return the substring from the specified start position to the end of the string, rather than causing an error.
Additional Information:
-
It seems that the current implementation does not perform adequate bounds checking when slicing the string, resulting in a panic when the length parameter is too large.
-
A potential fix would be to check the bounds and adjust the length to return the substring from the start position to the end of the string if the requested length exceeds the available characters.
Could you please look into this issue?
I've encountered an issue with the substring() function in the antchfx/xpath package. According to the XPath specification, if the length parameter exceeds the actual remaining length of the string, the function should return the substring from the specified start position to the end of the string, rather than causing an error.
Additional Information:
It seems that the current implementation does not perform adequate bounds checking when slicing the string, resulting in a panic when the length parameter is too large.
A potential fix would be to check the bounds and adjust the length to return the substring from the start position to the end of the string if the requested length exceeds the available characters.
Could you please look into this issue?