You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(3500 is just the value that triggers it on my machine, but the value can be a lot lower depending on the available memory. This only simulates a long string containing "1,2,3..." and where gsub is used to add a space after each comma)
And the result is:
java.lang.StackOverflowError
at net.thisptr.jackson.jq.internal.functions._SubImplFunction.concat(_SubImplFunction.java:50)
at net.thisptr.jackson.jq.internal.functions._SubImplFunction.concat(_SubImplFunction.java:63)
at net.thisptr.jackson.jq.internal.functions._SubImplFunction.concat(_SubImplFunction.java:63)
at net.thisptr.jackson.jq.internal.functions._SubImplFunction.concat(_SubImplFunction.java:63)
(...cut for brievety...)
Hello,
Using jackson-jq v0.0.13 (happens in v1.0 too), the implementation of
gsub
is prone to stack overflows.Here is a reproducer:
(
3500
is just the value that triggers it on my machine, but the value can be a lot lower depending on the available memory. This only simulates a long string containing "1,2,3..." and wheregsub
is used to add a space after each comma)And the result is:
The code seems to indeed show a stack is used: https://github.com/eiiches/jackson-jq/blob/master/0.x/jackson-jq/src/main/java/net/thisptr/jackson/jq/internal/functions/_SubImplFunction.java#L62
In v1, the code hasn't changed much, and should still suffer the same fate: https://github.com/eiiches/jackson-jq/blob/develop/1.x/jackson-jq/src/main/java/net/thisptr/jackson/jq/internal/functions/_SubImplFunction.java#L74
In this specific case, there is a workaround: replace
gsub(","; ", ")
bysplit(",") | join(", ")
, but gsub shouldn't blow up like that.The text was updated successfully, but these errors were encountered: