[nemiver] Don't overrun frames vector (Closes: #585516)



commit be41600b220d1977df6fea283a0e5d6692202b71
Author: Dodji Seketeli <dodji redhat com>
Date:   Mon Jun 15 09:57:21 2009 +0200

    Don't overrun frames vector (Closes: #585516)
    
    	* src/dbgengine/nmv-i-debugger.h: Properly initialise
    	IDebugger::Frame
    	* src/persp/dbgperspective/nmv-call-stack.cc
    	(CallStack::Priv::update_selected_frame): Do not overrun
    	frames vector.

 src/dbgengine/nmv-i-debugger.h             |    5 ++++-
 src/persp/dbgperspective/nmv-call-stack.cc |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index f2b2818..8b5f62e 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -246,7 +246,10 @@ public:
         UString m_library;
     public:
 
-        Frame () {clear ();}
+        Frame () :
+            m_level (0),
+            m_line (0)
+        {}
 
         /// \name accessors
 
diff --git a/src/persp/dbgperspective/nmv-call-stack.cc b/src/persp/dbgperspective/nmv-call-stack.cc
index 2049ecd..34e0fad 100644
--- a/src/persp/dbgperspective/nmv-call-stack.cc
+++ b/src/persp/dbgperspective/nmv-call-stack.cc
@@ -110,7 +110,7 @@ struct CallStack::Priv {
     sigc::connection on_selection_changed_connection;
     Gtk::Widget *callstack_menu;
     Glib::RefPtr<Gtk::ActionGroup> call_stack_action_group;
-    int cur_frame_index;
+    unsigned cur_frame_index;
     unsigned nb_frames_expansion_chunk;
     int frame_low;
     int frame_high;
@@ -229,6 +229,7 @@ struct CallStack::Priv {
         }
 
         cur_frame_index = (*a_row_iter)[columns ().frame_index];
+        THROW_IF_FAIL (cur_frame_index < frames.size ());
         cur_frame = frames[cur_frame_index];
         THROW_IF_FAIL (cur_frame.level () >= 0);
         in_set_cur_frame_trans = true;
@@ -556,6 +557,8 @@ struct CallStack::Priv {
     {
         LOG_FUNCTION_SCOPE_NORMAL_DD;
 
+        THROW_IF_FAIL (!a_frames.empty ());
+
         int dest_start_index = a_frames[0].level (),
             dest_end_index = a_frames.size () + dest_start_index - 1;
         unsigned level = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]