From: Mayank Sabharwal Date: Wed, 16 Nov 2016 04:12:16 +0000 (-0700) Subject: Fix an off-by-one error in GridIn::read_vtk. X-Git-Tag: v8.5.0-rc1~395^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b2e3c0d0f41023cc0b22e2ec77e112992ca4aae;p=dealii.git Fix an off-by-one error in GridIn::read_vtk. --- diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 9a06ab8156..25459fc092 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -224,7 +224,7 @@ void GridIn::read_vtk(std::istream &in) { subcelldata.boundary_quads.back().vertices[j] = vertex_indices[subcelldata.boundary_quads.back().vertices[j]]; } - quad_indices[no_quads] = no_quads + 1; + quad_indices[no_quads] = no_quads; no_quads++; } @@ -272,7 +272,7 @@ void GridIn::read_vtk(std::istream &in) { subcelldata.boundary_lines.back().vertices[j] = vertex_indices[subcelldata.boundary_lines.back().vertices[j]]; } - line_indices[no_lines] = no_lines + 1; + line_indices[no_lines] = no_lines; no_lines++; } @@ -361,6 +361,7 @@ void GridIn::read_vtk(std::istream &in) { double id; in >> id; + Assert (quad_indices[i] < subcelldata.boundary_quads.size(), ExcInternalError()); subcelldata.boundary_quads[quad_indices[i]].material_id = id; } } @@ -370,6 +371,7 @@ void GridIn::read_vtk(std::istream &in) { double id; in >> id; + Assert (line_indices[i] < subcelldata.boundary_lines.size(), ExcInternalError()); subcelldata.boundary_lines[line_indices[i]].material_id = id; } }