Validate arguments to StreamEncrypter#writeFrame().

This commit is contained in:
akwizgran
2017-03-27 16:26:49 +01:00
parent 1918346ae8
commit 510f99c7da
2 changed files with 58 additions and 0 deletions

View File

@@ -62,6 +62,8 @@ class StreamEncrypterImpl implements StreamEncrypter {
@Override
public void writeFrame(byte[] payload, int payloadLength,
int paddingLength, boolean finalFrame) throws IOException {
if (payloadLength < 0 || paddingLength < 0)
throw new IllegalArgumentException();
if (payloadLength + paddingLength > MAX_PAYLOAD_LENGTH)
throw new IllegalArgumentException();
// Don't allow the frame counter to wrap