.DISABLED-hgeol
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 5055 2936fc46b015
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
icculus@5054
     1
[patterns]
icculus@5054
     2
.hgeol = native
icculus@5054
     3
.hgignore = native
icculus@5054
     4
BUGS = native
icculus@5054
     5
CREDITS = native
icculus@5054
     6
INSTALL = native
icculus@5054
     7
NOTES = native
icculus@5054
     8
TODO = native
icculus@5054
     9
WhatsNew = native
icculus@5054
    10
**COPYING = native
icculus@5054
    11
**README = native
icculus@5054
    12
**doxyfile = native
icculus@5054
    13
**Doxyfile = native
icculus@5054
    14
**install-sh = LF
icculus@5054
    15
**mkinstalldirs = LF
icculus@5054
    16
**Makefile = LF
icculus@5054
    17
**Makefile.* = LF
icculus@5054
    18
test/automated/rwops/read = LF
icculus@5054
    19
**README.* = native
icculus@5054
    20
**.S = native
icculus@5054
    21
**.bmp = BIN
icculus@5054
    22
**.c = native
icculus@5054
    23
**.cc = native
icculus@5054
    24
**.cpp = native
icculus@5054
    25
**.csh = LF
icculus@5054
    26
**.dat = BIN
icculus@5054
    27
**.gdbinit = LF
icculus@5054
    28
build-scripts/config.guess = LF
icculus@5054
    29
**.h = native
icculus@5054
    30
**.htm = native
icculus@5054
    31
**.html = native
icculus@5054
    32
**.icns = BIN
icculus@5054
    33
**.in = LF
icculus@5054
    34
**.java = native
icculus@5054
    35
**.m = native
icculus@5054
    36
**.m4 = native
icculus@5054
    37
**.mk = LF
icculus@5054
    38
**.nib = BIN
icculus@5054
    39
**.pch = BIN
icculus@5054
    40
**.pdf = BIN
icculus@5054
    41
**.pl = native
icculus@5054
    42
**.plist = native
icculus@5054
    43
**.png = BIN
icculus@5054
    44
.indent.pro = LF
icculus@5054
    45
**.rc = native
icculus@5054
    46
**.rtf = BIN
icculus@5054
    47
**.sh = LF
icculus@5054
    48
**.sln = native
icculus@5054
    49
**.txt = native
icculus@5054
    50
**.vcp = native
icculus@5054
    51
**.vcproj = native
icculus@5054
    52
**.vcw = native
icculus@5054
    53
**.vcxproj = native
icculus@5054
    54
**.wav = BIN
icculus@5054
    55
**.xbm = BIN
icculus@5054
    56
**.xml = native
icculus@5054
    57
**.zip = BIN