20aa85
From ce58f18222a7b20e02bb5b3b8b328b11b1c29a31 Mon Sep 17 00:00:00 2001
20aa85
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
20aa85
Date: Fri, 9 Feb 2018 10:49:39 +0000
20aa85
Subject: [PATCH] ofz#6173 check index before use
20aa85
MIME-Version: 1.0
20aa85
Content-Type: text/plain; charset=UTF-8
20aa85
Content-Transfer-Encoding: 8bit
20aa85
20aa85
Change-Id: I09d15ab324af0a8b3566f11868eb3266a68c4afe
20aa85
Reviewed-on: https://gerrit.libreoffice.org/49486
20aa85
Tested-by: Jenkins <ci@libreoffice.org>
20aa85
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
20aa85
Tested-by: Caolán McNamara <caolanm@redhat.com>
20aa85
---
20aa85
 sw/source/filter/ww8/ww8toolbar.cxx | 4 +++-
20aa85
 1 file changed, 3 insertions(+), 1 deletion(-)
20aa85
20aa85
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
20aa85
index 15c0abb..3686a73 100644
20aa85
--- a/sw/source/filter/ww8/ww8toolbar.cxx
20aa85
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
20aa85
@@ -167,7 +167,9 @@ bool SwCTBWrapper::Read( SvStream& rS )
20aa85
     std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
20aa85
     for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); it != it_end; ++it )
20aa85
     {
20aa85
-        rCustomizations[ *it ].bIsDroppedMenuTB = true;
20aa85
+        if (*it < 0 || static_cast<size_t>(*it) >= rCustomizations.size())
20aa85
+            continue;
20aa85
+        rCustomizations[*it].bIsDroppedMenuTB = true;
20aa85
     }
20aa85
     return rS.good();
20aa85
 }
20aa85
-- 
20aa85
2.14.3
20aa85