From 7b2e3c0d0f41023cc0b22e2ec77e112992ca4aae Mon Sep 17 00:00:00 2001 From: Mayank Sabharwal Date: Tue, 15 Nov 2016 21:12:16 -0700 Subject: [PATCH] Fix an off-by-one error in GridIn::read_vtk. --- source/grid/grid_in.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } } -- 2.39.5