stleary / JSON-java

A reference implementation of a JSON package in Java.
http://stleary.github.io/JSON-java/index.html
Other
4.54k stars 2.56k forks source link

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

Closed jacob-wieland-gematik closed 1 week ago

jacob-wieland-gematik commented 4 months ago

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

stleary commented 4 months ago

@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.

hexetia commented 1 month ago

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

stleary commented 1 month ago

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

stleary commented 1 week ago

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