Skip to content

Commit

Permalink
Fixed potential nullpointer de-reference in the buffer-get-bline-w-hi…
Browse files Browse the repository at this point in the history
…nt function
  • Loading branch information
proh14 authored and adsr committed Nov 15, 2024
1 parent 3e2654c commit b170335
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ int buffer_get_bline_w_hint(buffer_t *self, bint_t line_index, bline_t *opt_hint

if (!opt_hint) {
opt_hint = self->first_line;
if (!opt_hint) { // Satisfy scan-build lint
*ret_bline = NULL;
return MLBUF_ERR;
}
}

fwd = opt_hint;
Expand Down Expand Up @@ -1406,10 +1410,12 @@ static int _buffer_redo(buffer_t *self, int by_group) {
// Get line to perform undo on
bline = NULL;
buffer_get_bline(self, action_to_redo->start_line_index, &bline);
MLBUF_BLINE_ENSURE_CHARS(bline);
if (!bline) {
return MLBUF_ERR;
} else if (action_to_redo->start_col > bline->char_count) {
}

MLBUF_BLINE_ENSURE_CHARS(bline);
if (action_to_redo->start_col > bline->char_count) {
return MLBUF_ERR;
}

Expand Down

0 comments on commit b170335

Please sign in to comment.