mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Merge pull request #10343 from jdgleaver/font-segfault-fix
(Menu) Prevent font-related segfaults when using extremely small scales/window sizes
This commit is contained in:
commit
2cc841a6cb
@ -713,13 +713,19 @@ font_data_t *gfx_display_font_file(
|
||||
char* fontpath, float menu_font_size, bool is_threaded)
|
||||
{
|
||||
font_data_t *font_data = NULL;
|
||||
float font_size = menu_font_size;
|
||||
|
||||
if (!dispctx)
|
||||
return NULL;
|
||||
|
||||
/* Font size must be at least 2, or font_init_first()
|
||||
* will generate a heap-buffer-overflow when using
|
||||
* many font drivers */
|
||||
font_size = (font_size > 2.0f) ? font_size : 2.0f;
|
||||
|
||||
if (!dispctx->font_init_first((void**)&font_data,
|
||||
video_driver_get_ptr(false),
|
||||
fontpath, menu_font_size, is_threaded))
|
||||
fontpath, font_size, is_threaded))
|
||||
return NULL;
|
||||
|
||||
return font_data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user