Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javadoc of XStream#setCollectionUpdateLimit seems wrong #284

Closed
daniel-beck opened this issue Feb 3, 2022 · 2 comments
Closed

Javadoc of XStream#setCollectionUpdateLimit seems wrong #284

daniel-beck opened this issue Feb 3, 2022 · 2 comments
Assignees
Labels
Milestone

Comments

@daniel-beck
Copy link

According to

* @param maxSeconds limit in seconds or 0 to disable check
setting the limit to 0 disables the protection.

Per

if (collectionUpdateLimit >= 0) {
and
if (collectionUpdateLimit >= 0) {
it seems 0 is a legal value to be set for the context limit.

Additionally,

final Integer limit = (Integer)context.get(XStream.COLLECTION_UPDATE_LIMIT);
if (limit == null) {
throw new ConversionException("Missing limit for updating collections.");
has no special behavior for 0.

It looks like callers need to pass negative values to skip setting the context values and disable the protection.

@joehni joehni self-assigned this Feb 4, 2022
@joehni joehni added the bug label Feb 4, 2022
@joehni
Copy link
Member

joehni commented Feb 4, 2022

Thanks for heads-up. Well, the Javadoc is right, the implementation is wrong. The entries in the data holder should not be created when the limit is 0. However, SecurityUtils is correct. Either seconds are counted, then you need a limit, or not.

@renjanmenon
Copy link

Is this a bug that needs to be fixed ? I'm unable to locate collectionUpdateLimit nor SecurityUtils in master .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants