return MP_VAL if n < 0. remove check for max int value

remove comment
This commit is contained in:
Ruby Martin
2026-03-03 09:00:45 -07:00
parent 0ef8541b73
commit 682901e32e
+2 -3
View File
@@ -101,13 +101,12 @@ static int I2OSP(int n, int w, byte* out)
{
int i;
if (w <= 0 || w > 32) {
if (w <= 0 || w > 32 || n < 0) {
return MP_VAL;
}
/* if width is less than int max check that n is less than w bytes max */
/* if width is greater than int max check that n is less than int max */
if ((w < 4 && n > ((1 << (w * 8)) - 1)) || (w >= 4 && n > 0x7fffffff)) {
if (w < 4 && n > ((1 << (w * 8)) - 1)) {
return MP_VAL;
}