.hgignore
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 6958 3aecdfd1c68b
child 7232 6f17d930be39
permissions -rw-r--r--
Fixed bug 1846 - _allmul implementation in SDL_stdlib.c doesn't clean up the stack

Colin Barrett

I see this manifest itself (VS2012 x86) as:

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

in the first call to SDL_GetTicks in my application. The disassembly at the problem line is:

hires_now.QuadPart *= 1000;
00AD0792 push 0
00AD0794 push 3E8h
00AD0799 mov eax,dword ptr [ebp-10h]
00AD079C push eax
00AD079D mov ecx,dword ptr [hires_now]
00AD07A0 push ecx
00AD07A1 call _allmul (0AE7D40h)
00AD07A6 mov dword ptr [hires_now],eax
00AD07A9 mov dword ptr [ebp-10h],edx

Apparently _allmul should be popping the stack but isn't (other similar functions in SDL_stdlib.c - _alldiv and whatnot - DO pop the stack).

A 'ret 10h' at the end of _allmul appears to do the trick
     1 syntax:glob
     2 .svn
     3 autom4te*
     4 config.cache
     5 config.log
     6 config.status
     7 Makefile
     8 sdl-config
     9 SDL2.spec
    10 build
    11 
    12 # for Xcode
    13 *.orig
    14 *.swp
    15 *.tmp
    16 *.rej
    17 *~
    18 *.o
    19 *.mode1*
    20 *.model*
    21 *.perspective*
    22 *.perspective*
    23 *.pbxuser
    24 (^|/)build($|/)
    25 .DS_Store
    26 Xcode/SDL/SDL.xcodeproj/xcuserdata
    27 Xcode/SDL/SDL.xcodeproj/project.xcworkspace
    28 Xcode/SDLTest/SDLTest.xcodeproj/xcuserdata
    29 Xcode/SDLTest/SDLTest.xcodeproj/project.xcworkspace
    30 Xcode-iOS/SDL/SDL.xcodeproj/xcuserdata
    31 Xcode-iOS/SDL/SDL.xcodeproj/project.xcworkspace
    32 Xcode-iOS/Demos/Demos.xcodeproj/xcuserdata
    33 Xcode-iOS/Demos/Demos.xcodeproj/project.xcworkspace
    34 
    35 # for Visual C++
    36 Debug
    37 Release
    38 *.user
    39 *.ncb
    40 *.suo
    41 
    42 # for Android
    43 android-project/local.properties
    44 
    45 sdl.pc
    46 test/autom4te*
    47 test/config.cache
    48 test/config.log
    49 test/config.status
    50 test/Makefile
    51 test/SDL2.dll
    52 test/checkkeys
    53 test/loopwave
    54 test/testatomic
    55 test/testaudioinfo
    56 test/testautomation
    57 test/testdraw2
    58 test/testerror
    59 test/testfile
    60 test/testgamecontroller
    61 test/testgesture
    62 test/testgl2
    63 test/testgles
    64 test/testhaptic
    65 test/testiconv
    66 test/testime
    67 test/testintersections
    68 test/testjoystick
    69 test/testkeys
    70 test/testloadso
    71 test/testlock
    72 test/testmessage
    73 test/testmultiaudio
    74 test/testnative
    75 test/testoverlay2
    76 test/testplatform
    77 test/testpower
    78 test/testrelative
    79 test/testrendercopyex
    80 test/testrendertarget
    81 test/testresample
    82 test/testrumble
    83 test/testscale
    84 test/testsem
    85 test/testshader
    86 test/testshape
    87 test/testsprite2
    88 test/testspriteminimal
    89 test/teststreaming
    90 test/testthread
    91 test/testtimer
    92 test/testver
    93 test/testwm2
    94 test/torturethread
    95 test/*.exe
    96 test/*.dSYM