[glom/glom-1-12] Fixed out-ouf-bounds access during CSV imports



commit 21e8f2953abccc9e73e14473c8267714596fcfa1
Author: Michael Hasselmann <michael taschenorakel de>
Date:   Sun Jan 24 19:59:24 2010 +0100

    Fixed out-ouf-bounds access during CSV imports
    
    * glom/import_csv/dialog_import_csv.cc (get_field_for_column): Added boundary
    check for direct field access. Fixes bug #607938.

 ChangeLog                            |    7 +++++++
 glom/import_csv/dialog_import_csv.cc |    3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 77ca335..f46f515 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-24  Michael Hasselmann  <michael taschenorakel de>
+
+	Fixed out-ouf-bounds access during CSV imports
+
+	* glom/import_csv/dialog_import_csv.cc (get_field_for_column): Added boundary
+	check for direct field access. Fixes bug #607938.
+
 2010-01-25 Murray Cumming <murrayc murrayc com>
 
 	* glom/libglom/data_structure/numeric_format.h: Remove unnecessary
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index dba9168..e04481f 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -221,6 +221,9 @@ guint Dialog_Import_CSV::get_column_count() const
 
 sharedptr<const Field> Dialog_Import_CSV::get_field_for_column(guint col) const
 {
+  if(col >= m_fields.size())
+    return sharedptr<const Field>();
+
   return m_fields[col];
 }
 



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