~mcf/cproc

ef3b6b33eba80b82ae3da1d8e322b531bfc99902 — NRK 17 days ago fb00ba6
expr: fix erroneous comparison

as long as `size_t`'s conversion rank is >= `int` this check would work
out fine.

but in case size_t happens to be less than int (which I believe is valid
under the C standard) then comparison will take place in `signed int`
and the operand `-1` will not get implicitly converted to SIZE_MAX.

explicitly cast it to size_t to avoid such issues.
1 files changed, 1 insertions(+), 1 deletions(-)

M expr.c
M expr.c => expr.c +1 -1
@@ 403,7 403,7 @@ decodechar(const char *src, uint_least32_t *chr, bool *hexoct, const char *desc,
		}
	} else {
		n = utf8dec(&c, s, 4);
		if (n == -1)
		if (n == (size_t)-1)
			error(loc, "%s contains invalid UTF-8", desc);
		s += n;
	}