mirror of https://github.com/fltk/fltk
Fix out-of-bounds memory access in Fl_Text_Display (STR #2730).
This bug would only show up in wrap mode. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10415 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
637ead9f99
commit
c3c5659479
|
@ -3369,10 +3369,14 @@ void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
|
||||||
if (b<lineStart) b = lineStart;
|
if (b<lineStart) b = lineStart;
|
||||||
if (!foundBreak) { /* no whitespace, just break at margin */
|
if (!foundBreak) { /* no whitespace, just break at margin */
|
||||||
newLineStart = max(p, buf->next_char(lineStart));
|
newLineStart = max(p, buf->next_char(lineStart));
|
||||||
const char *s = buf->address(b);
|
|
||||||
colNum++;
|
colNum++;
|
||||||
|
if (b >= buf->length()) { // STR #2730
|
||||||
|
width = 0;
|
||||||
|
} else {
|
||||||
|
const char *s = buf->address(b);
|
||||||
width = measure_proportional_character(s, 0, p+styleBufOffset);
|
width = measure_proportional_character(s, 0, p+styleBufOffset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (p >= maxPos) {
|
if (p >= maxPos) {
|
||||||
*retPos = maxPos;
|
*retPos = maxPos;
|
||||||
*retLines = maxPos < newLineStart ? nLines : nLines + 1;
|
*retLines = maxPos < newLineStart ? nLines : nLines + 1;
|
||||||
|
|
Loading…
Reference in New Issue