On Fri, Feb 25, 2011 at 11:41:31PM +1100, Peter Urbanec wrote:
dlls/gdi32/dib.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 0619304..595eb9b 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -885,7 +885,7 @@ INT WINAPI GetDIBits( */ if (bmp->dib->dsBmih.biHeight < 0) {
sbits += (srcwidthb * (abs(bmp->dib->dsBmih.biHeight) - 2 * startscan - 1));
sbits += (srcwidthb * (LONG)(abs(bmp->dib->dsBmih.biHeight) - 2 * startscan - 1));
Please enlighten us to the problem you are fixing? I see no 64bit pointer relation...?
Ciao, Marcus
On 26/02/11 00:05, Marcus Meissner wrote:
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 0619304..595eb9b 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -885,7 +885,7 @@ INT WINAPI GetDIBits( */ if (bmp->dib->dsBmih.biHeight< 0) {
sbits += (srcwidthb * (abs(bmp->dib->dsBmih.biHeight) - 2 * startscan - 1));
sbits += (srcwidthb * (LONG)(abs(bmp->dib->dsBmih.biHeight) - 2 * startscan - 1));
Please enlighten us to the problem you are fixing? I see no 64bit pointer relation...?
When running gdi32_test bitmap on Gentoo64, I see:
Unhandled exception: page fault on read access to 0x100240000 in 64-bit code (0x00007f7f8a708530).
Backtrace: =>0 0x00007f7f8a708530 in libc.so.6 (+0x127530) (0x000000000022f9b0) 1 0x00007f7f88b607c4 GetDIBits+0x11f9(hdc=0x25c, hbitmap=0x750, startscan=0x1, lines=0x1, bits=0x22fa1c, info=0x22fa20, coloruse=0) [/home/eyeon/source/wine/dlls/gdi32/dib.c:914] in gdi32 (0x000000000022f9b0) 2 0x00007f7f891face5 test_GetDIBits_single_pixel_destination+0x2d2(bpp=0x10) [/home/eyeon/source/wine/dlls/gdi32/tests/bitmap.c:3026] in gdi32_test (0x000000000022f9b0) 3 0x00007f7f891fb123 func_bitmap+0xc2() [/home/eyeon/source/wine/dlls/gdi32/tests/bitmap.c:3082] in gdi32_test (0x000000000022f9b0)
A little more tracing revealed that the above line without the (LONG) cast turned sbits from 0x240004 to 0x100240000, which in turn caused the page fault in memcpy(). With the (LONG) cast in place, I see sbits changing from 0x240004 to 0x240000, as expected.
Using gcc (Gentoo 4.5.2 p1.0, pie-0.4.5) 4.5.2 with -O0
The addition of the cast fixes the issue and allows the winetest to succeed.
Cheers,
Peter Urbanec