Skip to content

Commit 2e60e29

Browse files
committed
intn: intn_from_integer_bytes: set sign when sign != NULL
When sign parameter is non-null, always set it to a known value. This avoids annoying bugs. Signed-off-by: Davide Bettio <[email protected]>
1 parent a1aa48b commit 2e60e29

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libAtomVM/intn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,8 @@ int intn_from_integer_bytes(const uint8_t in[], size_t in_size, intn_from_intege
11821182
sign = IntNNegativeInteger;
11831183
}
11841184
*out_sign = sign;
1185+
} else if (out_sign) {
1186+
*out_sign = IntNPositiveInteger;
11851187
}
11861188

11871189
memset(out, filler, INTN_MAX_RES_LEN * sizeof(intn_digit_t));

0 commit comments

Comments
 (0)