Skip to content

Commit

Permalink
Merge pull request #965 from bettio/external-term-fix-sign-warning
Browse files Browse the repository at this point in the history
externalterm: fix a warning related to integer promotion

`size_t < uint8_t + constant` causes a warning due to promotion of
`uint8_t + constant` to int.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
  • Loading branch information
bettio committed Nov 29, 2023
2 parents 76349d0 + f0889b0 commit 047ccc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libAtomVM/externalterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ static int calculate_heap_usage(const uint8_t *external_term_buf, size_t remaini
}

case SMALL_BIG_EXT: {
uint8_t num_bytes = external_term_buf[1];
size_t num_bytes = external_term_buf[1];
if (UNLIKELY(num_bytes > 8 || remaining < (SMALL_BIG_EXT_BASE_SIZE + num_bytes))) {
return INVALID_TERM_SIZE;
}
Expand Down

0 comments on commit 047ccc7

Please sign in to comment.