1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00

Bug 902: set_hline: Assert that we didn't go past end of array.

This assertion detects the overflow that manifested as bug 902.
This commit is contained in:
Kalle Olavi Niemitalo 2006-12-20 23:19:24 +02:00 committed by Kalle Olavi Niemitalo
parent 114ce8c833
commit f396abcf19

View File

@ -471,7 +471,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
part->document->buf[i] = *chars++;
}
part->document->buf_length = i;
return x - x2;
break;
}
} else {
good_char:
@ -504,6 +504,13 @@ good_char:
}
}
/* Assert that we haven't written past the end of the
* LINE(y).chars array. @x here is one greater than
* the last one used in POS(x, y). Instead of this,
* we could assert(X(x) < LINE(y).length) immediately
* before each @copy_screen_chars call above, but
* those are in an inner loop that should be fast. */
assert(X(x) <= LINE(y).length);
len = x - x2;
} else {
if (utf8) {