summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-26 09:26:10 +0000
committerAndras Timar <andras.timar@collabora.com>2021-03-30 09:56:26 +0200
commit151a2ef72e12e87ac1bbdc2b8848454b8bc5e0f9 (patch)
tree3a9b26b0b2611a638c2dd6f5960ee2dab6805aad /hwpfilter
parenta17bcf7f91d1bdc47f4b83496a52f9da5f752e9c (diff)
ofz#32499 overflowing pos
Change-Id: I164537acbb4d4bcf7dee51a029ffb518a3687fda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113121 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hiodev.cxx4
1 files changed, 2 insertions, 2 deletions
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;