Fix unsigned integer overflow in _mem_is_ascii()

Found by OSS-Fuzz. It has no impact.
This commit is contained in:
Tim Rühsen 2017-11-03 12:10:05 +01:00 committed by Dagobert Michelsen
parent fa59acdeb8
commit 8530d396c1
1 changed files with 1 additions and 1 deletions

View File

@ -549,7 +549,7 @@ static ssize_t _utf8_to_utf32(const char *in, size_t inlen, punycode_uint *out,
static int _mem_is_ascii(const char *s, size_t n) static int _mem_is_ascii(const char *s, size_t n)
{ {
while (n--) for (; n; n--) /* 'while(n--)' generates unsigned integer overflow on n = 0 */
if (*((unsigned char *)s++) >= 128) if (*((unsigned char *)s++) >= 128)
return 0; return 0;