diff options
author | NRK <nrk@disroot.org> | 2022-05-11 21:20:55 +0600 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2022-05-11 11:15:56 -0700 |
commit | ef3b6b33eba80b82ae3da1d8e322b531bfc99902 (patch) | |
tree | 55ce92c8dd1fc5286d14dd5f07ed20ea67a23359 | |
parent | fb00ba697821de4fb3d8d0dd44edfa5f4727d067 (diff) |
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.
-rw-r--r-- | expr.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; } |