Skip to content

Commit

Permalink
[#1] fFix GUI compilation fail on OpenBSD i386
Browse files Browse the repository at this point in the history
Explicitely convert from goffset to gsize with prior overflow
check. Implicit conversion is forbidden by compiler settings.
  • Loading branch information
Marcus Lindemann committed Dec 4, 2022
1 parent f93adb9 commit 3343078
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/stlink-gui/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,14 @@ static gpointer stlink_gui_populate_filemem_view(gpointer data) {

if (gui->file_mem.memory) { g_free(gui->file_mem.memory); }

gui->file_mem.size = g_file_info_get_size(file_info);
goffset file_size = g_file_info_get_size(file_info);

if (G_MAXSIZE < file_size) {
stlink_gui_set_info_error_message(gui, "File too large.");
goto out_input;
}

gui->file_mem.size = (gsize) file_info;
gui->file_mem.memory = g_malloc(gui->file_mem.size);

for (off = 0; off < (gint)gui->file_mem.size; off += MEM_READ_SIZE) {
Expand Down

0 comments on commit 3343078

Please sign in to comment.