Fix comparator for overflow check

This commit is contained in:
Michael Theall 2015-11-20 09:44:58 -06:00
parent b21fa8a57f
commit a1157f7b8b
6 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ utf16_to_utf32(uint32_t *out,
*out++ = code;
}
if(SSIZE_MAX - 1 <= rc)
if(SSIZE_MAX - 1 >= rc)
++rc;
else
return -1;

View File

@ -39,7 +39,7 @@ utf16_to_utf8(uint8_t *out,
}
}
if(SSIZE_MAX - units <= rc)
if(SSIZE_MAX - units >= rc)
rc += units;
else
return -1;

View File

@ -26,7 +26,7 @@ utf32_to_utf16(uint16_t *out,
}
}
if(SSIZE_MAX - units <= rc)
if(SSIZE_MAX - units >= rc)
rc += units;
else
return -1;

View File

@ -30,7 +30,7 @@ utf32_to_utf8(uint8_t *out,
}
}
if(SSIZE_MAX - units <= rc)
if(SSIZE_MAX - units >= rc)
rc += units;
else
return -1;

View File

@ -35,7 +35,7 @@ utf8_to_utf16(uint16_t *out,
}
}
if(SSIZE_MAX - units <= rc)
if(SSIZE_MAX - units >= rc)
rc += units;
else
return -1;

View File

@ -26,7 +26,7 @@ utf8_to_utf32(uint32_t *out,
*out++ = code;
}
if(SSIZE_MAX - 1 <= rc)
if(SSIZE_MAX - 1 >= rc)
++rc;
else
return -1;