Skip to content

CronSequenceGenerator constructor goes into infinite loop with invalid increments [SPR-12871] #17469

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

Closed
spring-projects-issues opened this issue Mar 31, 2015 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 31, 2015

Edward opened SPR-12871 and commented

The constructor for the org.springframework.scheduling.support.CronSequenceGenerator will go into an infinite loop if one of the fields is of the form n/0

For example

public static void main (String[] s) {
    new CronSequenceGenerator("*/0 * * * * *");
    System.out.println("We will never get here");
}

I guess that either the /0 should be ignored, or it should throw an IllegalArgumentException


Affects: 3.2.13, 4.1.6

Issue Links:

Referenced from: commits ceb17fc, b5a56ca, 50f4977

Backported to: 3.2.14

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch. We're explicitly checking the incrementer delta to be 1 or higher now, raising a descriptive IllegalArgumentException if invalid. (Negative deltas led to a non-descriptive IndexOutOfBoundsException before.)

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Edward commented

Awesome - impressive turnaround!

Best regards
Ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants