Avoid null dereference in VESA initialization
If the VESA mode chooses a mode with 8 bit pixels, but the tile set has too many colors for that, a null dereference can result when trying to set up the nonexistent palette. Catch this condition and refuse to set VESA mode instead.
This commit is contained in:
+1
-1
@@ -1047,7 +1047,7 @@ vesa_Init(void)
|
|||||||
|
|
||||||
vesa_mode = 0xFFFF; /* might want an 8 bit mode after loading tiles */
|
vesa_mode = 0xFFFF; /* might want an 8 bit mode after loading tiles */
|
||||||
vesa_detect();
|
vesa_detect();
|
||||||
if (vesa_mode == 0xFFFF) {
|
if (vesa_mode == 0xFFFF || (vesa_pixel_size == 8 && get_palette() == NULL)) {
|
||||||
raw_printf("%s (%d)", "Reverting to TTY mode, no VESA mode available.",
|
raw_printf("%s (%d)", "Reverting to TTY mode, no VESA mode available.",
|
||||||
tilefailure);
|
tilefailure);
|
||||||
wait_synch();
|
wait_synch();
|
||||||
|
|||||||
Reference in New Issue
Block a user