Add integer check for alphabet size (#2458)

Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com>
This commit is contained in:
axjp 2026-06-15 09:05:24 +01:00 committed by GitHub
parent 7f0544e1c6
commit 91178a8e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,14 @@ class GenerateDeBruijnSequence extends Operation {
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive)."); throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
} }
if (!Number.isInteger(k)) {
throw new OperationError("Invalid alphabet size, required to be integer.");
}
if (!Number.isInteger(n)) {
throw new OperationError("Invalid key length, required to be integer.");
}
if (n < 2) { if (n < 2) {
throw new OperationError("Invalid key length, required to be at least 2."); throw new OperationError("Invalid key length, required to be at least 2.");
} }