From a881bb54bf4be80f561718c4c5854313650ba2dd Mon Sep 17 00:00:00 2001 From: nvs Date: Tue, 1 May 2018 17:28:50 -0700 Subject: Add brackets in SFileSetFilePointer when pointer < 0 This addresses a bug introduced in: - fe652fe4a6e02041194a0f1b29a0086bd99fb14d Brackets were not properly included, causing `SFILE_INVALID_POS` to be returned whenever `DeltaPos` was less than zero, instead of only when the resulting position was negative. --- src/SFileReadFile.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/SFileReadFile.cpp b/src/SFileReadFile.cpp index 3831165..a6b3bc4 100644 --- a/src/SFileReadFile.cpp +++ b/src/SFileReadFile.cpp @@ -868,8 +868,10 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi if((LONGLONG)DeltaPos < 0) { if(NewPosition > FileSize) // Position is negative + { SetLastError(ERROR_NEGATIVE_SEEK); return SFILE_INVALID_POS; + } } // If moving forward, don't allow the new position go past the end of the file -- cgit v1.2.3