[Libreoffice-commits] libcdr.git: src/lib

David Tardon dtardon at redhat.com
Wed Jan 31 12:31:10 UTC 2018


 src/lib/CMXParser.cpp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit dc5e9b17437c52af805e6674fbcd9a31e4ffd987
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Jan 31 13:28:51 2018 +0100

    ofz#5845 limit max. record nesting depth
    
    ... to avoid stack overflow.
    
    Change-Id: I2d0f01a14499e1e4d6543fc9db8beb14a2ea0644

diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 14137e5..e98bee5 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -29,6 +29,8 @@
 #define DUMP_IMAGE 0
 #endif
 
+static const int MAX_RECORD_DEPTH = 1 << 10;
+
 namespace
 {
 
@@ -80,7 +82,7 @@ libcdr::CMXParser::~CMXParser()
 
 bool libcdr::CMXParser::parseRecords(librevenge::RVNGInputStream *input, long size, unsigned level)
 {
-  if (!input)
+  if (!input || level > MAX_RECORD_DEPTH)
   {
     return false;
   }


More information about the Libreoffice-commits mailing list