Skip to content

Commit f21fcc1

Browse files
bearzlyBenjamin Gwin
andauthored
Fix use of uninitialized cursor variable (#1111)
The cursor_ variable was being default initialized, which causes undefined behaviour when accessing properties in ScreenInteractive::Draw. This caused a crash when running with UBSAN. ``` ftxui/src/ftxui/component/screen_interactive.cpp:852:17: runtime error: load of value 4195502944, which is not a valid value for type 'Shape' ``` This change causes the shape variable to be explicitly initialized, similar to the x and y members. Co-authored-by: Benjamin Gwin <[email protected]>
1 parent f7ac35e commit f21fcc1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/ftxui/screen/screen.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Screen : public Image {
6060
BarBlinking = 5,
6161
Bar = 6,
6262
};
63-
Shape shape;
63+
Shape shape = Hidden;
6464
};
6565

6666
Cursor cursor() const { return cursor_; }

0 commit comments

Comments
 (0)