We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2690 - Floating point exception in Mix_Volume()
Summary: Floating point exception in Mix_Volume()
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-18 00:07 UTC by Francisco de la Peña
Modified: 2014-08-23 17:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francisco de la Peña 2014-08-18 00:07:47 UTC
This happens rarely under uncertain circunstances, as it doesn't crash always and does it randomly. Fortunately, I've got a backtrace when running a GDB session. Might be a divide by zero issue in SDL or SDL_mixer.

Program received signal SIGFPE, Arithmetic exception.
0x00000038e8c08a7d in mix_channels (udata=<optimized out>, stream=0x24e11b0 "", len=2048) at mixer.c:345
345	                        Mix_Volume(i, (mix_channel[i].fade_volume * ticks) / mix_channel[i].fade_length );
(gdb) bt f
#0  0x00000038e8c08a7d in mix_channels (udata=<optimized out>, stream=0x24e11b0 "", len=2048) at mixer.c:345
        ticks = 0
        mix_input = <optimized out>
        i = 0
        mixable = <optimized out>
        volume = <optimized out>
        sdl_ticks = 129373
#1  0x000000345d219e0b in SDL_RunAudio (devicep=devicep@entry=0x24df950)
    at /usr/src/debug/SDL2-2.0.3/src/audio/SDL_audio.c:483
        silence = 0
        device = 0x24df950
        stream = 0x24e11b0 ""
        stream_len = 2048
        udata = 0x0
        fill = 0x38e8c089b0 <mix_channels>
        delay = 11
#2  0x000000345d27764d in SDL_RunThread (data=0x25870d0) at /usr/src/debug/SDL2-2.0.3/src/thread/SDL_thread.c:282
        args = 0x25870d0
        userfunc = 0x345d219cb0 <SDL_RunAudio>
        userdata = 0x24df950
        thread = 0x2588a30
        statusloc = 0x2588a40
#3  0x000000345d2c2b29 in RunThread (data=<optimized out>)
    at /usr/src/debug/SDL2-2.0.3/src/thread/pthread/SDL_systhread.c:72
No locals.
#4  0x0000003bd6607f33 in start_thread (arg=0x7ffff1f26700) at pthread_create.c:309
        __res = <optimized out>
        pd = 0x7ffff1f26700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737252583168, 8330904859251263453, 1, 38674912, 
                140737252583872, 140737252583168, -8330900440849889315, 8352766722943829981}, mask_was_saved = 0}}, 
---Type <return> to continue, or q <return> to quit---
          priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
#5  0x0000003bd62f4ded in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
No locals.

Using SDL 2.0.3 and SDL_Mixer 2.0.0, PulseAudio, Fedora 20 x86_64 but looks like can be reproduced on other platforms.
Comment 1 Sam Lantinga 2014-08-23 17:57:53 UTC
Nice catch!
https://hg.libsdl.org/SDL_mixer/rev/9599bb0ff844