Blob Blame History Raw
From ce58f18222a7b20e02bb5b3b8b328b11b1c29a31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 9 Feb 2018 10:49:39 +0000
Subject: [PATCH] ofz#6173 check index before use
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: I09d15ab324af0a8b3566f11868eb3266a68c4afe
Reviewed-on: https://gerrit.libreoffice.org/49486
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
---
 sw/source/filter/ww8/ww8toolbar.cxx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index 15c0abb..3686a73 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -167,7 +167,9 @@ bool SwCTBWrapper::Read( SvStream& rS )
     std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
     for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); it != it_end; ++it )
     {
-        rCustomizations[ *it ].bIsDroppedMenuTB = true;
+        if (*it < 0 || static_cast<size_t>(*it) >= rCustomizations.size())
+            continue;
+        rCustomizations[*it].bIsDroppedMenuTB = true;
     }
     return rS.good();
 }
-- 
2.14.3