Skip to content

Commit e546d31

Browse files
committed
Fix Coverity INTEGER_OVERFLOW in sp_to_unsigned_bin, avoid unsigned underflow
1 parent 7aec2a8 commit e546d31

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

wolfcrypt/src/sp_int.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18272,7 +18272,7 @@ int sp_to_unsigned_bin_len_ct(const sp_int* a, byte* out, int outSz)
1827218272
out[j--] = (byte)(d & mask);
1827318273
d >>= 8;
1827418274
}
18275-
mask &= (sp_int_digit)0 - notFull;
18275+
mask &= (sp_int_digit)(-(int)notFull);
1827618276
i += (unsigned int)(1 & mask);
1827718277
}
1827818278
}

0 commit comments

Comments
 (0)