[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann sbergman at redhat.com
Mon Oct 16 10:00:34 UTC 2017


 sal/osl/unx/file.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 13b596e29e5b2e2ab5e43f147db6638a856c52a6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 16 12:00:08 2017 +0200

    Fix overflow
    
    Change-Id: I1ddd1f7d749a99395fbd7be433db5884536bf7a7

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;
 


More information about the Libreoffice-commits mailing list