while (from < fromLim && to < toLim) {
switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
case BT_LEAD2:
- if (from + 2 > fromLim) {
+ if (fromLim - from < 2) {
res = XML_CONVERT_INPUT_INCOMPLETE;
break;
}
from += 2;
break;
case BT_LEAD3:
- if (from + 3 > fromLim) {
+ if (fromLim - from < 3) {
res = XML_CONVERT_INPUT_INCOMPLETE;
break;
}
case BT_LEAD4:
{
unsigned long n;
- if (to + 2 > toLim) {
+ if (toLim - to < 2) {
res = XML_CONVERT_OUTPUT_EXHAUSTED;
goto after;
}
- if (from + 4 > fromLim) {
+ if (fromLim - from < 4) {
res = XML_CONVERT_INPUT_INCOMPLETE;
goto after;
}
*fromP = from; \
return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
- if (from + 4 > fromLim) { \
+ if (fromLim - from < 4) { \
*fromP = from; \
return XML_CONVERT_INPUT_INCOMPLETE; \
} \