We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d49da4 commit 03bd248Copy full SHA for 03bd248
Sources/CryptoSwift/AES.swift
@@ -20,6 +20,8 @@ public final class AES: BlockCipher {
20
case invalidKeyOrInitializationVector
21
/// Invalid IV
22
case invalidInitializationVector
23
+ /// Invalid Data
24
+ case invalidData
25
}
26
27
public enum Variant: Int {
@@ -571,6 +573,10 @@ extension AES: Cipher {
571
573
572
574
var oneTimeCryptor = self.makeDecryptor()
575
let chunks = bytes.batched(by: AES.blockSize)
576
+ if chunks.count == 0 {
577
+ throw Error.invalidData
578
+ }
579
+
580
var out = Array<UInt8>()
581
out.reserveCapacity(bytes.count)
582
0 commit comments