mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Extend the scope of the line==NULL dialog box.
My theory that this report was completely obsolete seems to have been scuppered, in the most infuriating way possible: a user sent a report from 0.70 of a null-pointer crash happening moments _before_ that check, because the compressed line pointer passed to decompressline() was NULL. So there's still some need for this thing after all, and moreover, it should be happening just before that decompressline() call as well as after it!
This commit is contained in:
parent
ce7c18f600
commit
971b04f9de
42
terminal.c
42
terminal.c
@ -1045,6 +1045,27 @@ static int sblines(Terminal *term)
|
||||
return sblines;
|
||||
}
|
||||
|
||||
static void null_line_error(Terminal *term, int y, int lineno,
|
||||
tree234 *whichtree, int treeindex,
|
||||
const char *varname)
|
||||
{
|
||||
extern const char commitid[]; /* in version.c */
|
||||
modalfatalbox("%s==NULL in terminal.c\n"
|
||||
"lineno=%d y=%d w=%d h=%d\n"
|
||||
"count(scrollback=%p)=%d\n"
|
||||
"count(screen=%p)=%d\n"
|
||||
"count(alt=%p)=%d alt_sblines=%d\n"
|
||||
"whichtree=%p treeindex=%d\n"
|
||||
"commitid=%s\n\n"
|
||||
"Please contact <putty@projects.tartarus.org> "
|
||||
"and pass on the above information.",
|
||||
varname, lineno, y, term->cols, term->rows,
|
||||
term->scrollback, count234(term->scrollback),
|
||||
term->screen, count234(term->screen),
|
||||
term->alt_screen, count234(term->alt_screen),
|
||||
term->alt_sblines, whichtree, treeindex, commitid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve a line of the screen or of the scrollback, according to
|
||||
* whether the y coordinate is non-negative or negative
|
||||
@ -1079,29 +1100,16 @@ static termline *lineptr(Terminal *term, int y, int lineno, int screen)
|
||||
}
|
||||
if (whichtree == term->scrollback) {
|
||||
unsigned char *cline = index234(whichtree, treeindex);
|
||||
if (!cline)
|
||||
null_line_error(term, y, lineno, whichtree, treeindex, "cline");
|
||||
line = decompressline(cline, NULL);
|
||||
} else {
|
||||
line = index234(whichtree, treeindex);
|
||||
}
|
||||
|
||||
/* We assume that we don't screw up and retrieve something out of range. */
|
||||
if (line == NULL) {
|
||||
extern const char commitid[]; /* in version.c */
|
||||
modalfatalbox("line==NULL in terminal.c\n"
|
||||
"lineno=%d y=%d w=%d h=%d\n"
|
||||
"count(scrollback=%p)=%d\n"
|
||||
"count(screen=%p)=%d\n"
|
||||
"count(alt=%p)=%d alt_sblines=%d\n"
|
||||
"whichtree=%p treeindex=%d\n"
|
||||
"commitid=%s\n\n"
|
||||
"Please contact <putty@projects.tartarus.org> "
|
||||
"and pass on the above information.",
|
||||
lineno, y, term->cols, term->rows,
|
||||
term->scrollback, count234(term->scrollback),
|
||||
term->screen, count234(term->screen),
|
||||
term->alt_screen, count234(term->alt_screen),
|
||||
term->alt_sblines, whichtree, treeindex, commitid);
|
||||
}
|
||||
if (line == NULL)
|
||||
null_line_error(term, y, lineno, whichtree, treeindex, "line");
|
||||
assert(line != NULL);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user