JSON-java icon indicating copy to clipboard operation
JSON-java copied to clipboard

JSONArray has a bug when calling addAll with a collection (infinite recursion)

Open jacob-wieland-gematik opened this issue 1 year ago • 3 comments

In Line 1913, the jsonParserConfiguration needs to be passed as last argument

jacob-wieland-gematik avatar Jul 15 '24 12:07 jacob-wieland-gematik

@jacob-wieland-gematik Can you provide an example of this bug? What version are you using? The referenced line number, 1913, does not match the latest JSONArray code.

stleary avatar Jul 15 '24 18:07 stleary

I found this problem yesterday while upgrading from version 20231013 to 20240205. In PR https://github.com/stleary/JSON-java/pull/823 a regression was introduced with the addition of more parameters to the function addAll, the call to it on addAll from collection did not contemplate the inclusion of all the new parameters and will cause a stackoverflow error when calling the JsonArray.putAll with a list casted as Object image

hexetia avatar Oct 05 '24 14:10 hexetia

@hexetia Thanks for the info and analysis. Will look into this.

stleary avatar Oct 05 '24 15:10 stleary

Closing due to fixed in #907. Will be merged after 3-day window.

stleary avatar Nov 10 '24 23:11 stleary