From b835e6e03b30b5fb125680587fe580af244b66d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Sat, 23 Jun 2012 01:13:43 +0200 Subject: [PATCH] tex2lyx/table.cpp: fix bug #8204 also for branch (prevent crash if TeX files define wrong table column numbers) --- src/tex2lyx/table.cpp | 14 +++++++++++++- status.20x | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tex2lyx/table.cpp b/src/tex2lyx/table.cpp index 588d10c1b9..9884513a93 100644 --- a/src/tex2lyx/table.cpp +++ b/src/tex2lyx/table.cpp @@ -1156,8 +1156,20 @@ void handle_tabular(Parser & p, ostream & os, string const & name, cellinfo[row][col].content += os.str(); // add dummy cells for multicol - for (size_t i = 0; i < ncells - 1 && col < colinfo.size(); ++i) { + for (size_t i = 0; i < ncells - 1; ++i) { ++col; + if (col >= colinfo.size()) { + cerr << "The cell '" + << cells[cell] + << "' specifies " + << convert(ncells) + << " columns while the table has only " + << convert(colinfo.size()) + << " columns!" + << " Therefore the surplus columns will be ignored." + << endl; + break; + } cellinfo[row][col].multi = CELL_PART_OF_MULTICOLUMN; cellinfo[row][col].align = 'c'; } diff --git a/status.20x b/status.20x index 2d024faecd..945c2b6452 100644 --- a/status.20x +++ b/status.20x @@ -276,6 +276,8 @@ What's new - Fix missing backslash in import of \def ... \csname ... \endcsname (bug 8116). +- Fix crash if TeX-files contain table logic bugs (bug 8204). + * ADVANCED FIND AND REPLACE -- 2.39.5