mirror of
https://github.com/rkd77/elinks.git
synced 2025-04-18 00:47:36 -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:
parent
114ce8c833
commit
f396abcf19
@ -471,7 +471,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
|
|||||||
part->document->buf[i] = *chars++;
|
part->document->buf[i] = *chars++;
|
||||||
}
|
}
|
||||||
part->document->buf_length = i;
|
part->document->buf_length = i;
|
||||||
return x - x2;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
good_char:
|
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;
|
len = x - x2;
|
||||||
} else {
|
} else {
|
||||||
if (utf8) {
|
if (utf8) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user