From 762db7961e3592faa277b60f25173a6a7874d5c4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 24 May 2017 19:01:19 +0200 Subject: Add test for malformed s --- test/0x.js.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/0x.js.ts') diff --git a/test/0x.js.ts b/test/0x.js.ts index 651407af3..3d9a7a810 100644 --- a/test/0x.js.ts +++ b/test/0x.js.ts @@ -42,6 +42,16 @@ describe('ZeroEx library', () => { const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); expect(isValid).to.be.false; }); + it('s is not hex', () => { + const malformedS = signature.s.replace('0', 'z'); + const malformedSignature = { + v: signature.v, + r: signature.r, + s: malformedS, + }; + const isValid = ZeroEx.isValidSignature(data, malformedSignature, address); + expect(isValid).to.be.false; + }); }); it('should return false if the data doesn\'t pertain to the signature & address', () => { const isValid = ZeroEx.isValidSignature('wrong data', signature, address); -- cgit v1.2.3