[Libreoffice-commits] .: Branch 'libreoffice-3-4' - vcl/unx

Thorsten Behrens thorsten at kemper.freedesktop.org
Fri Sep 2 04:47:05 PDT 2011


 vcl/unx/gtk/app/gtkdata.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit cd19349339135af876d3c484813738c39a175a42
Author: Radek Doulik <rodo at novell.com>
Date:   Thu Sep 1 11:14:21 2011 +0200

    make sure we stay in array bounds
    
    Signed-off-by: Thorsten Behrens <tbehrens at novell.com>

diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index c38876b..6a61098 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -265,8 +265,10 @@ int GtkSalDisplay::GetDefaultMonitorNumber() const
     gint nMonitors = gdk_screen_get_n_monitors(pScreen);
     for (gint i = 0; i < nMonitors; ++i)
     {
-        if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0)
-            return m_aXineramaScreenIndexMap[i];
+        if (g_ascii_strncasecmp (gdk_screen_get_monitor_plug_name(pScreen, i), "LVDS", 4) == 0) {
+            OSL_ASSERT( size_t(i) < m_aXineramaScreenIndexMap.size() );
+            return (size_t(i) < m_aXineramaScreenIndexMap.size()) ? m_aXineramaScreenIndexMap[i] : 0;
+        }
     }
 #endif
     return 0;


More information about the Libreoffice-commits mailing list