From: Uwe Stöhr Date: Fri, 22 Jun 2012 23:13:43 +0000 (+0200) Subject: tex2lyx/table.cpp: fix bug #8204 also for branch (prevent crash if TeX files define... X-Git-Tag: 2.0.4~10 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b835e6e03b30b5fb125680587fe580af244b66d5;p=features.git tex2lyx/table.cpp: fix bug #8204 also for branch (prevent crash if TeX files define wrong table column numbers) --- 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