Skip to content

testtray: removing a tray item makes the test executable crash #12002

Closed
@madebr

Description

@madebr

I can easily crash testtray on Windows 10 by removing a tray item.

Crashing scenario 1:
  1. Run testtray
  2. Click on "Tray control menu" -> "Create Checkbox"
  3. Click on "Tray control menu" -> "New Checkbox" -> "Remove"
  4. Segmentation fault
    SDL_RemoveTrayEntry_REAL(SDL_TrayEntry *) SDL_tray.c:344
    SDL_RemoveTrayEntry(SDL_TrayEntry *) SDL_dynapi_procs.h:1252
    remove_entry(void *, SDL_TrayEntry *) testtray.c:97
    TrayWindowProc(HWND__ *, unsigned int, unsigned long long, long long) SDL_tray.c:130
    <unknown> 0x00007ffcc791ef5c
    <unknown> 0x00007ffcc791e684
    WIN_PumpEvents(SDL_VideoDevice *) SDL_windowsevents.c:2409
    SDL_PumpEventsInternal(bool) SDL_events.c:1376
    SDL_WaitEventTimeout_Device(SDL_VideoDevice *, SDL_Window *, SDL_Event *, unsigned long long, long long) SDL_events.c:1471
    SDL_WaitEventTimeoutNS(SDL_Event *, long long) SDL_events.c:1634
    SDL_WaitEvent_REAL(SDL_Event *) SDL_events.c:1542
    SDL_WaitEvent(SDL_Event *) SDL_dynapi_procs.h:1008
    SDL_main(int, char **) testtray.c:616
    SDL_RunApp_REAL(int, char **, int (*)(int, char **), void *) SDL_sysmain_runapp.c:88
    SDL_RunApp_DEFAULT(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
    SDL_RunApp(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
    main(int, char **) SDL_main_impl.h:103
    invoke_main() 0x00007ff7a4291af9
    __scrt_common_main_seh() 0x00007ff7a429199e
    __scrt_common_main() 0x00007ff7a429185e
    mainCRTStartup(void *) 0x00007ff7a4291b8e
    <unknown> 0x00007ffcc6957374
    <unknown> 0x00007ffcc7ebcc91
    
Crashing scenario 2:
  1. Run testtray

  2. Click on "Tray control menu" -> "Create Button"

  3. Click on "Tray control menu" -> "New Button" -> "Remove"

    The following message is printed on the terminal:

    Attempt to remove a menu that isn't a submenu. This shouldn't happen.

  4. Click on "Tray control menu" -> "New Button" -> "Remove" (try to remove item 2nd time)

  5. Segmentation fault

    try_realloc_chunk(malloc_state *, malloc_chunk *, unsigned long long, int) SDL_malloc.c:4853
    dlrealloc(void *, unsigned long long) SDL_malloc.c:5248
    SDL_realloc_REAL(void *, unsigned long long) SDL_malloc.c:6489
    SDL_RemoveTrayEntry_REAL(SDL_TrayEntry *) SDL_tray.c:362
    SDL_RemoveTrayEntry(SDL_TrayEntry *) SDL_dynapi_procs.h:1252
    remove_entry(void *, SDL_TrayEntry *) testtray.c:87
    TrayWindowProc(HWND__ *, unsigned int, unsigned long long, long long) SDL_tray.c:130
    <unknown> 0x00007ffcc791ef5c
    <unknown> 0x00007ffcc791e684
    WIN_PumpEvents(SDL_VideoDevice *) SDL_windowsevents.c:2409
    SDL_PumpEventsInternal(bool) SDL_events.c:1376
    SDL_WaitEventTimeout_Device(SDL_VideoDevice *, SDL_Window *, SDL_Event *, unsigned long long, long long) SDL_events.c:1471
    SDL_WaitEventTimeoutNS(SDL_Event *, long long) SDL_events.c:1634
    SDL_WaitEvent_REAL(SDL_Event *) SDL_events.c:1542
    SDL_WaitEvent(SDL_Event *) SDL_dynapi_procs.h:1008
    SDL_main(int, char **) testtray.c:616
    SDL_RunApp_REAL(int, char **, int (*)(int, char **), void *) SDL_sysmain_runapp.c:88
    SDL_RunApp_DEFAULT(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
    SDL_RunApp(int, char **, int (*)(int, char **), void *) SDL_dynapi_procs.h:804
    main(int, char **) SDL_main_impl.h:103
    invoke_main() 0x00007ff7a4291af9
    __scrt_common_main_seh() 0x00007ff7a429199e
    __scrt_common_main() 0x00007ff7a429185e
    mainCRTStartup(void *) 0x00007ff7a4291b8e
    <unknown> 0x00007ffcc6957374
    <unknown> 0x00007ffcc7ebcc91
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions