Skip to content

Commit

Permalink
weierstrass: prohibit messages longer than 8KB
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Nov 22, 2024
1 parent abd50ac commit 867b21e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/abstract/weierstrass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,8 @@ export function weierstrass(curveDef: CurveType): CurveFn {
const bits2int =
CURVE.bits2int ||
function (bytes: Uint8Array): bigint {
// Our custom check "just in case"
if (bytes.length > 8192) throw new Error('input is too large');
// For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)
// for some cases, since bytes.length * 8 is not actual bitLength.
const num = ut.bytesToNumberBE(bytes); // check for == u8 done here
Expand Down

0 comments on commit 867b21e

Please sign in to comment.