Add source length validation on backup media copy

This commit is contained in:
Ravi Khadiwala
2024-08-14 16:48:13 -05:00
committed by ravi-signal
parent 6cdfb7ab63
commit fd10b9723d
3 changed files with 37 additions and 2 deletions

View File

@@ -273,7 +273,7 @@ public class BackupManager {
final List<CopyParameters> toCopy) {
final long totalBytesAdded = toCopy.stream()
.mapToLong(copyParameters -> {
if (copyParameters.sourceLength() > MAX_MEDIA_OBJECT_SIZE) {
if (copyParameters.sourceLength() > MAX_MEDIA_OBJECT_SIZE || copyParameters.sourceLength() < 0) {
throw Status.INVALID_ARGUMENT
.withDescription("Invalid sourceObject size")
.asRuntimeException();