Skip to content

Commit cb8b539

Browse files
authored
Adding assertion as alluded in kokke#14
1 parent 5bac567 commit cb8b539

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ void bignum_from_string(struct bn* n, char* str, int nbytes)
101101
require(str, "str is null");
102102
require(nbytes > 0, "nbytes must be positive");
103103
require((nbytes & 1) == 0, "string format must be in hex -> equal number of bytes");
104-
104+
require((nbytes % (sizeof(DTYPE) * 2)) == 0, "string length must be a multiple of (sizeof(DTYPE) * 2) characters");
105+
105106
bignum_init(n);
106107

107108
DTYPE tmp; /* DTYPE is defined in bn.h - uint{8,16,32,64}_t */

0 commit comments

Comments
 (0)