Skip to content

Commit 26d52a8

Browse files
committed
check that the chunk is smaller than 5GB, when the size is actually parsed
1 parent ba0bf3a commit 26d52a8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/auth/streamingV4/trailingChecksumTransform.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { Transform } = require('stream');
22
const { errors } = require('arsenal');
3+
const { maximumAllowedPartSize } = require('../../../constants');
34

45
/**
56
* This class is designed to handle the chunks sent in a streaming
@@ -103,6 +104,10 @@ class TrailingChecksumTransform extends Transform {
103104
// last chunk, no more data to read, the stream is closed
104105
this.streamClosed = true;
105106
}
107+
if (dataSize > maximumAllowedPartSize) {
108+
this.log.error('chunk size too big', { dataSize });
109+
return callback(errors.EntityTooLarge);
110+
}
106111
this.bytesToRead = dataSize;
107112
this.bytesToDiscard = 2;
108113
}

0 commit comments

Comments
 (0)