[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - writerfilter/qa writerfilter/source
Caolán McNamara
caolanm at redhat.com
Thu Jul 28 22:03:38 UTC 2016
writerfilter/qa/cppunittests/rtftok/data/fail/popstate-1.rtf |binary
writerfilter/qa/cppunittests/rtftok/data/fail/popstate-2.rtf | 1
writerfilter/qa/cppunittests/rtftok/testrtftok.cxx | 4 +
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 31 +++++++++--
4 files changed, 32 insertions(+), 4 deletions(-)
New commits:
commit d029c0346fb1d4094768dfce00b19c0c53526b04
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jul 28 13:58:33 2016 +0100
fftester: throw on empty stack access
rather than spend the rest of my life protecting each one
Change-Id: I181df33b052a0303f072ce0252d98562231569e2
(cherry picked from commit 2710211eb2333cafdb894742a8fa73fb02dc513b)
fftester: empty states stack
Change-Id: I05dfffced9a8677650a46b43f65a29e9b21c5524
(cherry picked from commit 5de2d02806669812d43e7f23db58ab7a16373ce6)
Related: tdf#75757 remove inheritance from std::deque
Change-Id: Ia50ea146052c2014ea16474186e2d15ce93581c1
(cherry picked from commit 7a887df4db129ac5222fd4068173b5a06d107a59)
Reviewed-on: https://gerrit.libreoffice.org/27639
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-1.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-1.rtf
new file mode 100644
index 0000000..0418917
Binary files /dev/null and b/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-1.rtf differ
diff --git a/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-2.rtf b/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-2.rtf
new file mode 100644
index 0000000..273bb13
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/fail/popstate-2.rtf
@@ -0,0 +1 @@
+\\rttt\noTidqtpúúúúúúëúúúúúúúúúúúúúúúúdôp{\"pb18}\p{\"ptxtbr }
diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
index 1211037..e380728 100644
--- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
+++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
@@ -74,6 +74,10 @@ bool RtfTest::load(const OUString&,
}
throw;
}
+ catch (const std::exception&)
+ {
+ return false;
+ }
}
void RtfTest::test()
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 132df5a..d31b369 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -308,19 +308,42 @@ public:
};
/// An RTF stack is similar to std::stack, except that it has an operator[].
-struct RTFStack : public std::deque<RTFParserState>
+struct RTFStack
{
+private:
+ std::deque<RTFParserState> m_Impl;
+public:
RTFParserState& top()
{
- return back();
+ if (m_Impl.empty())
+ throw std::out_of_range("empty rtf state stack");
+ return m_Impl.back();
}
void pop()
{
- return pop_back();
+ if (m_Impl.empty())
+ throw std::out_of_range("empty rtf state stack");
+ return m_Impl.pop_back();
}
void push(RTFParserState const& rState)
{
- return push_back(rState);
+ return m_Impl.push_back(rState);
+ }
+ bool empty() const
+ {
+ return m_Impl.empty();
+ }
+ size_t size() const
+ {
+ return m_Impl.size();
+ }
+ const RTFParserState& operator[](size_t nIndex) const
+ {
+ return m_Impl[nIndex];
+ }
+ RTFParserState& operator[](size_t nIndex)
+ {
+ return m_Impl[nIndex];
}
};
More information about the Libreoffice-commits
mailing list