mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(glue): bound DeleteSchemaVersions ranges before expanding them (#3508)
A Versions expression such as 1-9223372036854775807 was expanded into a list before the 25 version limit was checked, so a single request could exhaust memory. Reject any range that would expand to more than MAX_DELETE_SCHEMA_VERSIONS entries with InvalidInputException up front, and cover the exact 25 version boundary.
This commit is contained in:
1 parent
2a4ca61baf
commit
76c1907214
2 files changed
+31
-2
No files matched your search
+10
-2
@@ -725,8 +725,16 @@ public class GlueSchemaRegistryService {
|
||||
throw new AwsException("InvalidInputException",
|
||||
"Invalid version range: " + token, 400);
|
||||
}
|
||||
for (long v = start; v <= end; v++) {
|
||||
versions.add(v);
|
||||
// Bound the range before expanding it so a request such as 1-9223372036854775807
|
||||
// is rejected outright instead of materialising every version number.
|
||||
long rangeSize = end - start;
|
||||
if (rangeSize >= MAX_DELETE_SCHEMA_VERSIONS) {
|
||||
throw new AwsException("InvalidInputException",
|
||||
"Versions expression cannot expand to more than "
|
||||
+ MAX_DELETE_SCHEMA_VERSIONS + " versions", 400);
|
||||
}
|
||||
for (long offset = 0; offset <= rangeSize; offset++) {
|
||||
versions.add(start + offset);
|
||||
}
|
||||
} else {
|
||||
versions.add(Long.parseLong(token));
|
||||
|
||||
Reference in new issue
Block a user