summaryrefslogtreecommitdiffstats
path: root/test/WhiteBoxTests.cpp
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2021-04-16 21:21:18 +0100
committerMichael Meeks <michael.meeks@collabora.com>2021-04-16 22:43:17 +0100
commit2fcc5451d7fdb8eeaf47ecc26161c4c52ad25270 (patch)
tree9030865c0bbcf0308fb6d22786022f792204d61d /test/WhiteBoxTests.cpp
parentUpdate l10n files for Weblate (diff)
downloadonline-2fcc5451d7fdb8eeaf47ecc26161c4c52ad25270.tar.gz
online-2fcc5451d7fdb8eeaf47ecc26161c4c52ad25270.zip
Avoid errno == ERANGE poisoning numerical conversions.
Change-Id: I0156310257caf7c578fb273393566a0970b3bb1f Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'test/WhiteBoxTests.cpp')
-rw-r--r--test/WhiteBoxTests.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/WhiteBoxTests.cpp b/test/WhiteBoxTests.cpp
index 405dc09bbc..75e7d710eb 100644
--- a/test/WhiteBoxTests.cpp
+++ b/test/WhiteBoxTests.cpp
@@ -45,6 +45,7 @@ class WhiteBoxTests : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(testRegexListMatcher);
CPPUNIT_TEST(testRegexListMatcher_Init);
CPPUNIT_TEST(testEmptyCellCursor);
+ CPPUNIT_TEST(testTileDesc);
CPPUNIT_TEST(testRectanglesIntersect);
CPPUNIT_TEST(testAuthorization);
CPPUNIT_TEST(testJson);
@@ -75,6 +76,7 @@ class WhiteBoxTests : public CPPUNIT_NS::TestFixture
void testRegexListMatcher();
void testRegexListMatcher_Init();
void testEmptyCellCursor();
+ void testTileDesc();
void testRectanglesIntersect();
void testAuthorization();
void testJson();
@@ -697,6 +699,18 @@ void WhiteBoxTests::testEmptyCellCursor()
documentViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY", &callbackDescriptor);
}
+void WhiteBoxTests::testTileDesc()
+{
+ // simulate a previous overflow
+ errno = ERANGE;
+ TileDesc desc = TileDesc::parse(
+ "tile nviewid=0 part=5 width=256 height=256 tileposx=0 tileposy=12288 tilewidth=3072 tileheight=3072 oldwid=0 wid=0 ver=33");
+ (void)desc; // exception in parse if we have problems.
+ TileCombined combined = TileCombined::parse(
+ "tilecombine nviewid=0 part=5 width=256 height=256 tileposx=0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504,0,3072,6144,9216,12288,15360,18432,21504 tileposy=0,0,0,0,0,0,0,0,3072,3072,3072,3072,3072,3072,3072,3072,6144,6144,6144,6144,6144,6144,6144,6144,9216,9216,9216,9216,9216,9216,9216,9216,12288,12288,12288,12288,12288,12288,12288,12288,15360,15360,15360,15360,15360,15360,15360,15360,18432,18432,18432,18432,18432,18432,18432,18432 oldwid=2,3,4,5,6,7,8,8,9,10,11,12,13,14,15,16,17,18,19,20,21,0,0,0,24,25,26,27,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 tilewidth=3072 tileheight=3072");
+ (void)combined; // exception in parse if we have problems.
+}
+
void WhiteBoxTests::testRectanglesIntersect()
{
// these intersect