[Libreoffice-commits] libmspub.git: 2 commits - src/lib
David Tardon
dtardon at redhat.com
Tue May 2 14:32:02 UTC 2017
src/lib/Coordinate.h | 4 ++--
src/lib/MSPUBParser97.cpp | 12 +++++-------
2 files changed, 7 insertions(+), 9 deletions(-)
New commits:
commit fcfdbdf6d0481e8c709f8033181e8da09142cff9
Author: David Tardon <dtardon at redhat.com>
Date: Tue May 2 16:31:18 2017 +0200
ofz#1004 fix signed integer overflow
Change-Id: I2cb4414464fe62c2b88b6cdcda3a9ba52cf82800
diff --git a/src/lib/Coordinate.h b/src/lib/Coordinate.h
index f15ffb4..336eb09 100644
--- a/src/lib/Coordinate.h
+++ b/src/lib/Coordinate.h
@@ -27,11 +27,11 @@ struct Coordinate
}
double getWidthIn() const
{
- return double(m_xe - m_xs) / EMUS_IN_INCH;
+ return double(int64_t(m_xe) - m_xs) / EMUS_IN_INCH;
}
double getHeightIn() const
{
- return double(m_ye - m_ys) / EMUS_IN_INCH;
+ return double(int64_t(m_ye) - m_ys) / EMUS_IN_INCH;
}
};
}
commit 6a7bc865eac08ab145b15e504b931e040700015e
Author: David Tardon <dtardon at redhat.com>
Date: Tue May 2 16:26:40 2017 +0200
ofz#1288 fix signed integer overflow
Change-Id: I282a6c1b1c5d4ce95d73e6bc59c4e5be574f0802
diff --git a/src/lib/MSPUBParser97.cpp b/src/lib/MSPUBParser97.cpp
index f3b29a2..867a1cf 100644
--- a/src/lib/MSPUBParser97.cpp
+++ b/src/lib/MSPUBParser97.cpp
@@ -9,6 +9,7 @@
#include "MSPUBParser97.h"
+#include <limits>
#include <memory>
#include <utility>
@@ -263,14 +264,11 @@ MSPUBParser97::TextInfo97 MSPUBParser97::getTextInfo(librevenge::RVNGInputStream
int MSPUBParser97::translateCoordinateIfNecessary(int coordinate) const
{
- if (m_isBanner)
- {
- return coordinate - 120 * EMUS_IN_INCH;
- }
+ const int offset = (m_isBanner ? 120 : 25) * EMUS_IN_INCH;
+ if (std::numeric_limits<int>::min() + offset > coordinate)
+ return std::numeric_limits<int>::min();
else
- {
- return coordinate - 25 * EMUS_IN_INCH;
- }
+ return coordinate - offset;
}
unsigned MSPUBParser97::getFirstLineOffset() const
More information about the Libreoffice-commits
mailing list