CronSequenceGenerator prevents stack overflow in case of inverted range

Issue: SPR-14462
(cherry picked from commit da59b4d)
This commit is contained in:
Juergen Hoeller
2016-07-14 21:11:28 +02:00
parent 97d73eb70c
commit 44152ce401
2 changed files with 31 additions and 7 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -379,6 +379,10 @@ public class CronSequenceGenerator {
throw new IllegalArgumentException("Range less than minimum (" + min + "): '" +
field + "' in expression \"" + this.expression + "\"");
}
if (result[0] > result[1]) {
throw new IllegalArgumentException("Invalid inverted range: '" + field +
"' in expression \"" + this.expression + "\"");
}
return result;
}