Skip to content

Commit 5800544

Browse files
authored
[BOX32] Fix copy-paste bug in SDL_ShowMessageBox (#3619)
In my32_2_SDL_ShowMessageBox, the loop converting 32-bit SDL_MessageBoxButtonData to 64-bit incorrectly read src[i].buttonid for all three fields instead of src[i].flags and src[i].text. This caused the button text pointer to be set to a small integer, resulting in a SIGSEGV when native SDL tried to read the text string.
1 parent 9a394d3 commit 5800544

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wrapped32/wrappedsdl2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,9 @@ EXPORT int my32_2_SDL_ShowMessageBox(my_SDL_MessageBoxData_32_t* msgbox, int* bt
772772
msgbox_l.colorScheme = from_ptrv(msgbox->colorScheme);
773773
my_SDL_MessageBoxButtonData_32_t* src = from_ptrv(msgbox->buttons);
774774
for(int i=0; i<msgbox_l.numbuttons; ++i) {
775-
btns_l[i].flags = src[i].buttonid;
775+
btns_l[i].flags = src[i].flags;
776776
btns_l[i].buttonid = src[i].buttonid;
777-
btns_l[i].text = from_ptrv(src[i].buttonid);
777+
btns_l[i].text = from_ptrv(src[i].text);
778778
}
779779
return my->SDL_ShowMessageBox(&msgbox_l, btn);
780780
}

0 commit comments

Comments
 (0)