[Libreoffice-commits] core.git: hwpfilter/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 26 10:52:07 UTC 2021


 hwpfilter/source/hiodev.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5453c8b92727eebdd1edbd36cd72c7042128f610
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 26 09:26:10 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 26 11:51:21 2021 +0100

    ofz#32499 overflowing pos
    
    Change-Id: I164537acbb4d4bcf7dee51a029ffb518a3687fda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113150
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx
index 56d4719e4302..a9bd14b57b11 100644
--- a/hwpfilter/source/hiodev.cxx
+++ b/hwpfilter/source/hiodev.cxx
@@ -337,7 +337,7 @@ size_t HMemIODev::readBlock(void *p, size_t size)
 {
     if (state())
         return 0;
-    if (length < pos + size)
+    if (size > length - pos)
         size = length - pos;
     memcpy(p, ptr + pos, size);
     pos += size;
@@ -346,7 +346,7 @@ size_t HMemIODev::readBlock(void *p, size_t size)
 
 size_t HMemIODev::skipBlock(size_t size)
 {
-    if (state() || length < pos + size)
+    if (state() || size > length - pos)
         return 0;
     pos += size;
     return size;


More information about the Libreoffice-commits mailing list