Skip to content

Double free or corruption loading unusual WAV files #406

@lordmauve

Description

@lordmauve

I see hard crashes with a freshly built pygame 1.9.4 when attempting to load WAV sound files with unusual codecs.

Thread 1 "python" received signal SIGABRT, Aborted.
0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff782702a in __GI_abort () at abort.c:89
#2  0x00007ffff78677ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff7980ed8 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff787037a in malloc_printerr (ar_ptr=<optimised out>, ptr=<optimised out>, str=0x7ffff7981008 "double free or corruption (!prev)", action=3)
    at malloc.c:5006
#4  _int_free (av=<optimised out>, p=<optimised out>, have_lock=0) at malloc.c:3867
#5  0x00007ffff787453c in __GI___libc_free (mem=<optimised out>) at malloc.c:2968
#6  0x00007ffff785d363 in _IO_new_fclose (fp=0x14394e0) at iofclose.c:84
#7  0x00007ffff492c539 in stdio_close (context=0x1439710) at ./src/file/SDL_rwops.c:357
#8  0x00007ffff01bdda6 in Mix_LoadWAV_RW (src=src@entry=0x1439710, freesrc=freesrc@entry=1) at mixer.c:565
#9  0x00007fffed6b6626 in sound_init (self=0x7fffe180be68, arg=<optimised out>, kwarg=<optimised out>) at src/mixer.c:1578

The files I'm testing with are here:

https://github.com/lordmauve/pgzero/tree/master/test/sounds

I see this crash with wav22kgsm.wav, wav22kulaw.wav, wav8kmp316.wav and wav8kmp38.wav.

I'm building against

ii  libsdl-mixer1.2:amd64                1.2.12-11build1         amd64                   Mixer library for Simple DirectMedia Layer 1.2, libraries
ii  libsdl-mixer1.2-dev:amd64            1.2.12-11build1         amd64                   Mixer library for Simple DirectMedia Layer 1.2, development files

To Do to close this:

  • See if these files also fail to load with C code in using latest SDL_mixer.
  • If so report on SDL bugzilla and set this to Difficulty Waiting.
  • Close if SDL_mixer is updated with fixes

Related docs: https://www.pygame.org/docs/ref/mixer.html#pygame.mixer.Sound

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions