summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-10-16 12:00:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-10-16 12:00:08 +0200
commit13b596e29e5b2e2ab5e43f147db6638a856c52a6 (patch)
tree361f5edc87fb9a417044b2ce064db8be952def47 /sal
parent1818bffa3e97a47f5bdde0bca9ea6679b93543d2 (diff)
Fix overflow
Change-Id: I1ddd1f7d749a99395fbd7be433db5884536bf7a7
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 4c62c8ec4bd5..5f723dd9a2d3 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1477,7 +1477,8 @@ oslFileError SAL_CALL osl_setFilePos(oslFileHandle Handle, sal_uInt32 uHow, sal_
if ((nOffset < 0) && (nPos < -1*nOffset))
return osl_File_E_INVAL;
- if (limit_off_t < (sal_Int64) nPos + nOffset)
+ assert(nPos >= 0);
+ if (nOffset > MAX_OFF_T - nPos)
return osl_File_E_OVERFLOW;
break;
@@ -1486,7 +1487,8 @@ oslFileError SAL_CALL osl_setFilePos(oslFileHandle Handle, sal_uInt32 uHow, sal_
if ((nOffset < 0) && (nPos < -1*nOffset))
return osl_File_E_INVAL;
- if (limit_off_t < (sal_Int64) nPos + nOffset)
+ assert(nPos >= 0);
+ if (nOffset > MAX_OFF_T - nPos)
return osl_File_E_OVERFLOW;
break;