[Bug 32169] PowerGrep v4.x 64-bit crashes on startup (GetLocaleInfo() returns improper TCHAR count for LOCALE_IFIRSTDAYOFWEEK)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Apr 28 13:54:46 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=32169

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
          Component|-unknown                    |kernel32
            Summary|page fault on read access   |PowerGrep v4.x 64-bit
                   |to 0x013ed370 in 64-bit     |crashes on startup
                   |code (0x00000000004096e9)   |(GetLocaleInfo() returns
                   |                            |improper TCHAR count for
                   |                            |LOCALE_IFIRSTDAYOFWEEK)
     Ever Confirmed|0                           |1

--- Comment #3 from Anastasius Focht <focht at gmx.net> 2013-04-28 13:54:46 CDT ---
Hello folks,

confirming.

--- snip ---
...
0024:Call KERNEL32.IsWow64Process(ffffffffffffffff,0022fb9c) ret=0066566d
0024:Ret  KERNEL32.IsWow64Process() retval=00000001 ret=0066566d
0024:Call KERNEL32.GetThreadLocale() ret=00665b66
0024:Ret  KERNEL32.GetThreadLocale() retval=00000409 ret=00665b66
0024:Call KERNEL32.GetLocaleInfoW(00000409,0000100c,00000000,00000000)
ret=00665ac2
0024:Ret  KERNEL32.GetLocaleInfoW() retval=00000003 ret=00665ac2
0024:Call KERNEL32.GetLocaleInfoW(00000409,0000100c,013ee600,00000003)
ret=00665afc
0024:Ret  KERNEL32.GetLocaleInfoW() retval=00000002 ret=00665afc
0024:Call user32.LoadStringW(00400000,0000ff40,0022da60,00001000) ret=00412a97
0024:Ret  user32.LoadStringW() retval=00000023 ret=00412a97
0024:Call KERNEL32.RaiseException(0eedfade,00000001,00000007,0022fa58)
ret=0040b716
0024:trace:seh:raise_exception code=eedfade flags=1 addr=0x7b84a251 ip=7b84a251
tid=0024
0024:trace:seh:raise_exception  info[0]=00000000004304a2
0024:trace:seh:raise_exception  info[1]=0000000001412d00
0024:trace:seh:raise_exception  info[2]=0000000000000000
0024:trace:seh:raise_exception  info[3]=0000000000000000
0024:trace:seh:raise_exception  info[4]=0000000000000000
0024:trace:seh:raise_exception  info[5]=0000000000000000
0024:trace:seh:raise_exception  info[6]=0000000000000000
0024:trace:seh:raise_exception  rax=000000000022f690 rbx=000000007bae1f9d
rcx=000000000022f690 rdx=00000036fed43ff2
0024:trace:seh:raise_exception  rsi=000000000022fa58 rdi=000000000022f6b0
rbp=000000000022f7e0 rsp=000000000022f670
0024:trace:seh:raise_exception   r8=0000000000000038  r9=000000000022fa58
r10=0020002700270000 r11=00000036fed7bc80
0024:trace:seh:raise_exception  r12=0000000000014bcc r13=00007ffff6d7c180
r14=0000000000000000 r15=0000000000000000
--- snip ---

The app uses GetLocaleInfo() with LCType = LOCALE_IFIRSTDAYOFWEEK to query for
first day of week.
It seems there is a misconception in Wine regarding data buffer sizes (TCHAR
counting).

MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318101%28v=vs.85%29.aspx

--- quote ---
Parameters

...
lpLCData [out, optional]

    Pointer to a buffer in which this function retrieves the requested locale
information. This pointer is not used if cchData is set to 0. For more
information, see the Remarks section.
cchData [in]

    Size, in TCHAR values, of the data buffer indicated by lpLCData.
Alternatively, the application can set this parameter to 0. In this case, the
function does not use the lpLCData parameter and returns the required buffer
size, including the terminating null character.

...
Return value

Returns the number of characters retrieved in the locale data buffer if
successful and cchData is a nonzero value. If the function succeeds, cchData is
nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of
the integer retrieved in the data buffer; that is, 2 for the Unicode version of
the function or 4 for the ANSI version. If the function succeeds and the value
of cchData is 0, the return value is the required size, in characters including
a null character, for the locale data buffer.
--- quote ---

As seen in trace log:

Wine returns 3 on first call (= fetch size, NULL terminator included).
Wine returns 2 on second call (app supplies cchData=3, null terminator
included).

I expected 2 and 1 respectively: 1 TCHAR stringified LOCALE_IFIRSTDAYOFWEEK + 1
TCHAR null terminator.

The app parser code uses some ascii char -> decimal conversion and doesn't
expect to parse a null character (Wine returns 2), hence the exception/crash.

With corrected TCHAR count the app starts properly.

$ du -sh SetupPowerGREPDemo.exe 
14M    SetupPowerGREPDemo.exe

$ sha1sum SetupPowerGREPDemo.exe 
aee9d7d313d7fa7a9fcd859425e4a43068df0ff3  SetupPowerGREPDemo.exe

$ wine --version
wine-1.5.29-38-g8e4317c

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list