From e6368749d463b14905600c90c8ddc0a007b7261c Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Fri, 14 Oct 2016 17:37:26 +0200 Subject: [PATCH] Fix: Dereference of null pointer in fvterm.cpp --- src/fvterm.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/fvterm.cpp b/src/fvterm.cpp index b3bbce04..313c1965 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -372,6 +372,13 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h) while ( iter != end ) { term_area* win = (*iter)->getVWin(); + + if ( ! win ) + break; + + if ( ! win->visible ) + break; + int win_x = win->x_offset; int win_y = win->y_offset; FRect geometry ( win_x @@ -380,7 +387,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h) , win->height + win->bottom_shadow ); // window visible and contains current character - if ( win && win->visible && geometry.contains(tx+x, ty+y) ) + if ( geometry.contains(tx+x, ty+y) ) { FOptiAttr::char_data* tmp; int line_len = win->width + win->right_shadow; @@ -465,6 +472,13 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y while ( iter != end ) { term_area* win = (*iter)->getVWin(); + + if ( ! win ) + break; + + if ( ! win->visible ) + break; + int win_x = win->x_offset; int win_y = win->y_offset; FRect geometry ( win_x @@ -472,9 +486,7 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y , win->width + win->right_shadow , win->height + win->bottom_shadow ); - if ( win && found - && win->visible - && geometry.contains(x,y) ) + if ( found && geometry.contains(x,y) ) { FOptiAttr::char_data* tmp; int line_len = win->width + win->right_shadow; @@ -1188,6 +1200,13 @@ FOptiAttr::char_data FVTerm::getCharacter ( character_type char_type if ( obj && *iter != obj && significant_char ) { term_area* win = (*iter)->getVWin(); + + if ( ! win ) + break; + + if ( ! win->visible ) + break; + int win_x = win->x_offset; int win_y = win->y_offset; FRect geometry ( win_x @@ -1196,7 +1215,7 @@ FOptiAttr::char_data FVTerm::getCharacter ( character_type char_type , win->height + win->bottom_shadow ); // window visible and contains current character - if ( win && win->visible && geometry.contains(x,y) ) + if ( geometry.contains(x,y) ) { FOptiAttr::char_data* tmp; int line_len = win->width + win->right_shadow;