Alexandre Julliard : windowscodecs: Fix incorrect overflow check caused by test mistake.
Alexandre Julliard
julliard at winehq.org
Fri Sep 25 10:25:43 CDT 2009
Module: wine
Branch: master
Commit: 77c3997e905d4e9abfc9b4767294aa8eca309e8a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77c3997e905d4e9abfc9b4767294aa8eca309e8a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Sep 25 15:57:41 2009 +0200
windowscodecs: Fix incorrect overflow check caused by test mistake.
---
dlls/windowscodecs/stream.c | 3 +--
dlls/windowscodecs/tests/stream.c | 5 +++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c
index 5672ff5..c59a9d2 100644
--- a/dlls/windowscodecs/stream.c
+++ b/dlls/windowscodecs/stream.c
@@ -129,13 +129,12 @@ static HRESULT WINAPI StreamOnMemory_Seek(IStream *iface,
LARGE_INTEGER NewPosition;
TRACE("(%p)\n", This);
- if (dlibMove.QuadPart > 0xFFFFFFFF) return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
-
if (dwOrigin == STREAM_SEEK_SET) NewPosition.QuadPart = dlibMove.QuadPart;
else if (dwOrigin == STREAM_SEEK_CUR) NewPosition.QuadPart = This->dwCurPos + dlibMove.QuadPart;
else if (dwOrigin == STREAM_SEEK_END) NewPosition.QuadPart = This->dwMemsize + dlibMove.QuadPart;
else return E_INVALIDARG;
+ if (NewPosition.u.HighPart) return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
if (NewPosition.QuadPart > This->dwMemsize) return E_INVALIDARG;
if (NewPosition.QuadPart < 0) return E_INVALIDARG;
This->dwCurPos = NewPosition.u.LowPart;
diff --git a/dlls/windowscodecs/tests/stream.c b/dlls/windowscodecs/tests/stream.c
index 197712e..6eff70a 100644
--- a/dlls/windowscodecs/tests/stream.c
+++ b/dlls/windowscodecs/tests/stream.c
@@ -107,9 +107,10 @@ static void test_StreamOnMemory(void)
ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == sizeof(Memory) - 1, "bSeek cursor moved to position (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart);
IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, &uNewPos); /* reset seek pointer */
- LargeInt.QuadPart = -sizeof(Memory) - 5;
+ LargeInt.QuadPart = -(LONGLONG)sizeof(Memory) - 5;
hr = IWICStream_Seek(pStream, LargeInt, STREAM_SEEK_END, &uNewPos);
- ok(hr == E_INVALIDARG, "Seek returned with %#x, expected %#x\n", hr, E_INVALIDARG);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW),
+ "Seek returned with %#x, expected %#x\n", hr, HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW));
ok(uNewPos.u.HighPart == 0 && uNewPos.u.LowPart == 0, "bSeek cursor moved to position (%u;%u), expected (%u;%u)\n", uNewPos.u.HighPart, uNewPos.u.LowPart, 0, 0); /* remains unchanged */
IWICStream_Seek(pStream, LargeNull, STREAM_SEEK_SET, NULL);
More information about the wine-cvs
mailing list