From fc193b6518ad8df0cc92cb50b88217430dea47e3 Mon Sep 17 00:00:00 2001 From: Léo Le Bouter Date: Fri, 5 Mar 2021 23:31:15 +0100 Subject: gnu: cgal: Update to 5.2 [security fixes]. * gnu/packages/patches/cgal-security-pr-5371.patch: New patch. Downloaded from , with hunks on files matching pattern "*Convex_decomposition_3*" removed because they don't exist in cgal's released sources. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/graphics.scm (cgal): Update to 5.2. [source]: Apply patch. --- gnu/local.mk | 1 + gnu/packages/graphics.scm | 10 +- gnu/packages/patches/cgal-security-pr-5371.patch | 1611 ++++++++++++++++++++++ 3 files changed, 1618 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/cgal-security-pr-5371.patch diff --git a/gnu/local.mk b/gnu/local.mk index 25afb99618..4900dabc36 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -879,6 +879,7 @@ dist_patch_DATA = \ %D%/packages/patches/cdparanoia-fpic.patch \ %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch \ %D%/packages/patches/ceph-disable-cpu-optimizations.patch \ + %D%/packages/patches/cgal-security-pr-5371.patch \ %D%/packages/patches/chmlib-inttypes.patch \ %D%/packages/patches/cl-asdf-config-directories.patch \ %D%/packages/patches/clamav-config-llvm-libs.patch \ diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm index 7e83c7ea4e..db04b93f20 100644 --- a/gnu/packages/graphics.scm +++ b/gnu/packages/graphics.scm @@ -718,15 +718,17 @@ more.") (define-public cgal (package (name "cgal") - (version "4.14.2") + (version "5.2") (source (origin (method url-fetch) (uri (string-append - "https://github.com/CGAL/cgal/releases/download/releases/" - "CGAL-" version "/CGAL-" version ".tar.xz")) + "https://github.com/CGAL/cgal/releases/download/v" version + "/CGAL-" version ".tar.xz")) (sha256 (base32 - "08lrp3hfwdypggz4138bnkh6bjxn441zg2y9xnq5mrjfc5ini6w1")))) + "08sr2k2dm4zasfbvisqpvs6djqw3rywzwpzr701an870nvnqck3l")) + (patches (search-patches "cgal-security-pr-5371.patch")) + (patch-flags '("-p2")))) (build-system cmake-build-system) (arguments '(#:tests? #f)) ; no test target diff --git a/gnu/packages/patches/cgal-security-pr-5371.patch b/gnu/packages/patches/cgal-security-pr-5371.patch new file mode 100644 index 0000000000..dea53dceaf --- /dev/null +++ b/gnu/packages/patches/cgal-security-pr-5371.patch @@ -0,0 +1,1611 @@ +From 618b409b0fbcef7cb536a4134ae3a424ef5aae45 Mon Sep 17 00:00:00 2001 +From: Maxime Gimeno +Date: Mon, 18 Jan 2021 15:40:40 +0100 +Subject: [PATCH 1/8] Fix Nef_2 and Nef_S2 IO + +--- + Nef_2/include/CGAL/Nef_2/PM_io_parser.h | 74 ++++++++++++--- + Nef_2/include/CGAL/Nef_polyhedron_2.h | 2 + + Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h | 106 ++++++++++++++++------ + 3 files changed, 142 insertions(+), 40 deletions(-) + +diff --git a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +index 85295f3d85a..9b84dd37fbe 100644 +--- a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h ++++ b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +@@ -200,6 +200,11 @@ bool PM_io_parser::read_vertex(Vertex_handle v) + !(in >> p) || + !check_sep("}") ) return false; + ++ if(!(f >= 0 && ((iso && f < fn) || (!iso && f < en)))) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + if (iso) v->set_face(Face_of[f]); + else v->set_halfedge(Halfedge_of[f]); + mark(v) = m; point(v) = p; +@@ -229,10 +234,14 @@ bool PM_io_parser::read_hedge(Halfedge_handle e) + !(in >> f) || !check_sep(",") || + !(in >> m) || !check_sep("}") ) + return false; +- CGAL_assertion_msg +- (eo >= 0 || (std::size_t) eo < en || epr >= 0 || (std::size_t) epr < en || ene >= 0 || (std::size_t) ene < en || +- v >= 0 || (std::size_t) v < vn || f >= 0 || (std::size_t) f < fn , +- "wrong index in read_hedge"); ++ ++ if(!(eo >= 0 && (std::size_t) eo < en && epr >= 0 && (std::size_t) epr < en && ene >= 0 && (std::size_t) ene < en && ++ v >= 0 && (std::size_t) v < vn && f >= 0 && (std::size_t) f < fn )) ++ { ++ in.clear(std::ios_base::badbit); ++ std::cerr<<"wrong index in read_hedge"<opposite()]); +@@ -267,14 +276,32 @@ bool PM_io_parser::read_face(Face_handle f) + int n, ei, vi; Mark m; + if ( !(in >> n) || !check_sep("{") ) return false; + if ( !(in >> ei) || !check_sep(",") ) return false; +- if (ei >= 0) f->set_halfedge(Halfedge_of[ei]); ++ if (ei >= 0 && ei < en) ++ { ++ f->set_halfedge(Halfedge_of[ei]); ++ } ++ else ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + while (in >> ei) { + CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list."); ++ if (!(ei >= 0 && ei < en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + f->store_fc(Halfedge_of[ei]); + } in.clear(); + if (!check_sep(",")) { return false; } + while (in >> vi) { + CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list."); ++ if (!(vi >= 0 && vi < vn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + f->store_iv(Vertex_of[vi]); + } in.clear(); + if (!check_sep(",") || !(in >> m) || !check_sep("}") ) +@@ -313,13 +340,26 @@ template + void PM_io_parser::read() + { + if ( !check_sep("Plane_map_2") ) +- CGAL_error_msg("PM_io_parser::read: no embedded_PM header."); ++ { ++ std::cerr<<"PM_io_parser::read: no embedded_PM header."<> vn)) ) +- CGAL_error_msg("PM_io_parser::read: wrong node line."); ++ { ++ std::cerr<<"PM_io_parser::read: wrong node line."<> en) && (en%2==0)) ) +- CGAL_error_msg("PM_io_parser::read: wrong edge line."); ++ { ++ std::cerr<<"PM_io_parser::read: wrong edge line."<> fn)) ) +- CGAL_error_msg("PM_io_parser::read: wrong face line."); ++ { ++ std::cerr<<"PM_io_parser::read: wrong face line."<::read() + + for(i=0; i> + std::cerr << "Nef_polyhedron_2 input corrupted." << std::endl; + NP = Nef_polyhedron_2(); + } ++ if(!is) ++ return is; + typename Nef_polyhedron_2::Topological_explorer D(NP.explorer()); + D.check_integrity_and_topological_planarity(); + return is; +diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h +index 7bddd3036d5..631c63dc5dc 100644 +--- a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h ++++ b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h +@@ -203,8 +203,14 @@ bool SM_io_parser::read_vertex(SVertex_handle v) + !(in >> p) || + !check_sep("}") ) return false; + +- if (iso) set_face(v,SFace_of[f]); +- else set_first_out_edge(v,Edge_of[f]); ++ if(f<0 || (iso && f > fn) || (!iso && f > en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } ++ ++ if (iso) this->set_face(v,SFace_of[f]); ++ else this->set_first_out_edge(v,Edge_of[f]); + v->mark() = m; v->point() = p; + return true; + } +@@ -235,17 +241,21 @@ bool SM_io_parser::read_edge(SHalfedge_handle e) + !(in >> m) || !check_sep(",") || + !(in >> k) || !check_sep("}") ) + return false; +- CGAL_assertion_msg ++ if (! + (eo >= 0 && eo < en && epr >= 0 && epr < en && ene >= 0 && ene < en && +- v >= 0 && v < vn && f >= 0 && f < fn , +- "wrong index in read_edge"); ++ v >= 0 && v < vn && f >= 0 && f < fn )) ++ { ++ std::cerr<<"wrong index in read_edge"<twin()]); +- set_prev(e,Edge_of[epr]); +- set_next(e,Edge_of[ene]); +- set_source(e,SVertex_of[v]); +- set_face(e,SFace_of[f]); ++ this->set_prev(e,Edge_of[epr]); ++ this->set_next(e,Edge_of[ene]); ++ this->set_source(e,SVertex_of[v]); ++ this->set_face(e,SFace_of[f]); + e->mark() = m; + e->circle() = k; + return true; +@@ -274,7 +284,7 @@ bool SM_io_parser::read_loop(SHalfloop_handle l) + CGAL_assertion_msg( + (lo >= 0 && lo < 2 && f >= 0 && f < fn),"wrong index in read_edge"); + +- set_face(l,SFace_of[f]); ++ this->set_face(l,SFace_of[f]); + l->mark() = m; + l->circle() = k; + return true; +@@ -303,21 +313,33 @@ bool SM_io_parser::read_face(SFace_handle f) + int n, ei, vi, li; Mark m; + if ( !(in >> n) || !check_sep("{") ) return false; + while (in >> ei) { +- CGAL_assertion_msg(ei >= 0 && ei < en, +- "wrong index in face cycle list."); +- store_sm_boundary_object(Edge_of[ei],f); ++ if(!(ei >= 0 && ei < en)) ++ { ++ std::cerr<<"wrong index in face cycle list."<store_sm_boundary_object(Edge_of[ei],f); + } in.clear(); + if (!check_sep(",")) { return false; } + while (in >> vi) { +- CGAL_assertion_msg(vi >= 0 && vi < vn, +- "wrong index in iso vertex list."); +- store_sm_boundary_object(SVertex_of[vi],f); ++ if(!(vi >= 0 && vi < vn)) ++ { ++ std::cerr<<"wrong index in iso vertex list."<store_sm_boundary_object(SVertex_of[vi],f); + } in.clear(); + if (!check_sep(",")) { return false; } + while (in >> li) { +- CGAL_assertion_msg(li >= 0 && li < 2, +- "wrong index in iso vertex list."); +- store_sm_boundary_object(Loop_of[li],f); ++ if(!(li >= 0 && li < 2)) ++ { ++ std::cerr<<"wrong index in iso vertex list."<store_sm_boundary_object(Loop_of[li],f); + } in.clear(); + if (!check_sep(",") || !(in >> m) || !check_sep("}") ) + return false; +@@ -357,16 +379,36 @@ void SM_io_parser::print() const + template + void SM_io_parser::read() + { ++ if ( !check_sep("Nef_polyhedron_S2") ) ++ { ++ std::cerr<<"Missing line in header"<> vn)) ) +- CGAL_error_msg("SM_io_parser::read: wrong vertex line."); ++ { ++ std::cerr<<"SM_io_parser::read: wrong vertex line."<> en) && (en%2==0)) ) +- CGAL_error_msg("SM_io_parser::read: wrong edge line."); ++ { ++ std::cerr<<"SM_io_parser::read: wrong edge line."<> ln)) ) +- CGAL_error_msg("SM_io_parser::read: wrong loop line."); ++ { ++ std::cerr<<"SM_io_parser::read: wrong loop line."<> fn)) ) +- CGAL_error_msg("SM_io_parser::read: wrong face line."); ++ { ++ std::cerr<<"SM_io_parser::read: wrong face line."<::read() + + for(i=0; i +Date: Tue, 19 Jan 2021 12:24:08 +0100 +Subject: [PATCH 2/8] Fix Nef_3 + +--- + Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 195 ++++++++++++++++++++++- + 1 file changed, 188 insertions(+), 7 deletions(-) + +diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +index 5eee7528ee7..04d9d0ac8e8 100644 +--- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h ++++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +@@ -1444,40 +1444,61 @@ void SNC_io_parser::read_items(int plus01) { + typename std::vector::iterator vi; + for(vi=Vertex_of.begin(); vi!=Vertex_of.end(); ++vi) { + if (!read_vertex(*vi)) +- CGAL_error_msg("SNC_io_parser::read: error in node line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in node line"<::iterator ei; + for(ei=Edge_of.begin(); ei!=Edge_of.end(); ++ei) { + if (!read_edge(*ei)) +- CGAL_error_msg("SNC_io_parser::read: error in edge line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in edge line"<::iterator vhf_iterator; + vhf_iterator fi; + for(fi=Halffacet_of.begin(); fi!=Halffacet_of.end(); ++fi) { + if (!read_facet(*fi)) +- CGAL_error_msg("SNC_io_parser::read: error in facet line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in facet line"<::iterator ci; + for(ci=Volume_of.begin()+plus01; ci!=Volume_of.end(); ++ci) { + if (!read_volume(*ci)) +- CGAL_error_msg("SNC_io_parser::read: error in volume line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in volume line"<::iterator sei; + for(sei=SEdge_of.begin(); sei!=SEdge_of.end(); ++sei) { + if (!read_sedge(*sei)) +- CGAL_error_msg("SNC_io_parser::read: error in sedge line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in sedge line"<::iterator sli; + for(sli=SLoop_of.begin(); sli!=SLoop_of.end(); ++sli) { + if (!read_sloop(*sli)) +- CGAL_error_msg("SNC_io_parser::read: error in sloop line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in sloop line"<::iterator sfi; + for(sfi=SFace_of.begin(); sfi!=SFace_of.end(); ++sfi) { + if (!read_sface(*sfi)) +- CGAL_error_msg("SNC_io_parser::read: error in sface line"); ++ { ++ std::cerr<<"SNC_io_parser::read: error in sface line"<sncp()); +@@ -1535,21 +1556,56 @@ read_vertex(Vertex_handle vh) { + vh->sncp() = this->sncp(); + + in >> index; ++ if(index >= int(en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->svertices_begin() = (index >= 0 ? Edge_of[index] : this->svertices_end()); + in >> index; ++ if(index >= int(en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->svertices_last() = index >= 0 ? Edge_of[index] : this->svertices_end(); + OK = OK && test_string(","); + in >> index; ++ if(index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->shalfedges_begin() = index >= 0 ? SEdge_of[index] : this->shalfedges_end(); + in >> index; ++ if(index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->shalfedges_last() = index >= 0 ? SEdge_of[index] : this->shalfedges_end(); + OK = OK && test_string(","); + in >> index; ++ if(index >= int(sfn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->sfaces_begin() = index >= 0 ? SFace_of[index] : this->sfaces_end(); + in >> index; ++ if(index >= int(sfn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->sfaces_last() = index >= 0 ? SFace_of[index] : this->sfaces_end(); + OK = OK && test_string(","); + in >> index; ++ if(index >= int(sln)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + vh->shalfloop() = index >= 0 ? SLoop_of[index] : this->shalfloops_end(); + OK = OK && test_string("|"); + #ifdef CGAL_NEF_NATURAL_COORDINATE_INPUT +@@ -1604,17 +1660,37 @@ read_edge(Halfedge_handle eh) { + OK = OK && test_string("{"); + + in >> index; ++ if(index < 0 || index >= int(en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + eh->twin() = Edge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(vn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + eh->center_vertex() = Vertex_of[index]; + OK = OK && test_string(","); + in >> index; + if(index == 0) { + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + eh->out_sedge() = SEdge_of[index]; + } else { + in >> index; ++ if(index < 0 || index >= int(sfn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + eh->incident_sface() = SFace_of[index]; + } + OK = OK && test_string("|"); +@@ -1669,6 +1745,11 @@ read_facet(Halffacet_handle fh) { + OK = OK && test_string("{"); + + in >> index; ++ if(index < 0 || index >= int(fn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + fh->twin() = Halffacet_of[index]; + OK = OK && test_string(","); + +@@ -1676,6 +1757,11 @@ read_facet(Halffacet_handle fh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + fh->boundary_entry_objects().push_back(make_object(SEdge_of[index])); + in >> cc; + } +@@ -1684,11 +1770,21 @@ read_facet(Halffacet_handle fh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; ++ if(index < 0 || index >= int(sln)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + fh->boundary_entry_objects().push_back(make_object(SLoop_of[index])); + in >> cc; + } + + in >> index; ++ if(index < 0 || index >= int(vn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + fh->incident_volume() = Volume_of[index+addInfiBox]; + OK = OK && test_string("|"); + #ifdef CGAL_NEF_NATURAL_COORDINATE_INPUT +@@ -1731,6 +1827,11 @@ read_volume(Volume_handle ch) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; ++ if(index < 0 || index >= int(sfn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + ch->shell_entry_objects().push_back(make_object(SFace_of[index])); + in >> cc; + } +@@ -1781,27 +1882,67 @@ read_sedge(SHalfedge_handle seh) { + OK = OK && test_string("{"); + + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->twin() = SEdge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->sprev() = SEdge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->snext() = SEdge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(en)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->source() = Edge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(sfn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->incident_sface() = SFace_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->prev() = SEdge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(sen)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->next() = SEdge_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= int(fn)) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + seh->facet() = Halffacet_of[index]; + OK = OK && test_string("|"); + #ifdef CGAL_NEF_NATURAL_COORDINATE_INPUT +@@ -1852,12 +1993,27 @@ read_sloop(SHalfloop_handle slh) { + OK = OK && test_string("{"); + + in >> index; ++ if(index < 0 || index >= sln) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + slh->twin() = SLoop_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= sfn) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + slh->incident_sface() = SFace_of[index]; + OK = OK && test_string(","); + in >> index; ++ if(index < 0 || index >= fn) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + slh->facet() = Halffacet_of[index]; + OK = OK && test_string("|"); + #ifdef CGAL_NEF_NATURAL_COORDINATE_INPUT +@@ -1904,6 +2060,11 @@ read_sface(SFace_handle sfh) { + OK = OK && test_string("{"); + + in >> index; ++ if(index < 0 || index >= vn) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + sfh->center_vertex() = Vertex_of[index]; + OK = OK && test_string(","); + +@@ -1913,6 +2074,11 @@ read_sface(SFace_handle sfh) { + in >> index; + // sfh->boundary_entry_objects().push_back(SEdge_of[index]); + SM_decorator SD(&*sfh->center_vertex()); ++ if(index < 0 || index >= sen) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + SD.link_as_face_cycle(SEdge_of[index],sfh); + in >> cc; + } +@@ -1921,6 +2087,11 @@ read_sface(SFace_handle sfh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; ++ if(index < 0 || index >= en) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + sfh->boundary_entry_objects().push_back(make_object(Edge_of[index])); + this->sncp()->store_sm_boundary_item(Edge_of[index], --(sfh->sface_cycles_end())); + in >> cc; +@@ -1930,12 +2101,22 @@ read_sface(SFace_handle sfh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; ++ if(index < 0 || index >= sln) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + sfh->boundary_entry_objects().push_back(make_object(SLoop_of[index])); + this->sncp()->store_sm_boundary_item(SLoop_of[index], --(sfh->sface_cycles_end())); + in >> cc; + } + + in >> index; ++ if(index < 0 || index >= vn) ++ { ++ in.clear(std::ios_base::badbit); ++ return false; ++ } + sfh->volume() = Volume_of[index+addInfiBox]; + OK = OK && test_string("}"); + in >> sfh->mark(); + +From 9e291e6bbfe23137fb2dd3a0f8d6461229ca2376 Mon Sep 17 00:00:00 2001 +From: Maxime Gimeno +Date: Tue, 19 Jan 2021 14:04:54 +0100 +Subject: [PATCH 3/8] replace cerr by CGAL_warning_msg + +--- + Nef_2/include/CGAL/Nef_2/PM_io_parser.h | 14 +++--- + Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 53 ++++++++++++++++------- + Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h | 18 ++++---- + 3 files changed, 54 insertions(+), 31 deletions(-) + +diff --git a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +index 9b84dd37fbe..52bc830e115 100644 +--- a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h ++++ b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +@@ -341,23 +341,23 @@ void PM_io_parser::read() + { + if ( !check_sep("Plane_map_2") ) + { +- std::cerr<<"PM_io_parser::read: no embedded_PM header."<> vn)) ) + { +- std::cerr<<"PM_io_parser::read: wrong node line."<> en) && (en%2==0)) ) + { +- std::cerr<<"PM_io_parser::read: wrong edge line."<> fn)) ) + { +- std::cerr<<"PM_io_parser::read: wrong face line."<::read() + for(i=0; i + void SNC_io_parser::read() + { + if ( !check_sep("Selective Nef Complex") ) +- CGAL_error_msg("SNC_io_parser::read: no SNC header."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: no SNC header."); ++ returnl ++ } + std::string kernel_type; + in >> kernel_type; + CGAL_assertion(kernel_type == "standard" || kernel_type == "extended"); + if ( !(check_sep("vertices") && (in >> vn)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong vertex line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong vertex line."); ++ return; ++ } + if ( !(check_sep("halfedges") && (in >> en) && (en%2==0)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong edge line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong edge line."); ++ return; ++ } + if ( !(check_sep("facets") && (in >> fn) && (fn%2==0)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong facet line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong facet line."); ++ } + if ( !(check_sep("volumes") && (in >> cn)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong volume line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong volume line."); ++ return; ++ } + if ( !(check_sep("shalfedges") && (in >> sen)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong sedge line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong sedge line."); ++ return; ++ } + if ( !(check_sep("shalfloops") && (in >> sln)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong sloop line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong sloop line."); ++ return; ++ } + if ( !(check_sep("sfaces") && (in >> sfn)) ) +- CGAL_error_msg("SNC_io_parser::read: wrong sface line."); ++ { ++ CGAL_warning_msg(false, "SNC_io_parser::read: wrong sface line."); ++ return; ++ } + + addInfiBox = (kernel_type == "standard" && Infi_box::extended_kernel()); + +@@ -1445,7 +1468,7 @@ void SNC_io_parser::read_items(int plus01) { + for(vi=Vertex_of.begin(); vi!=Vertex_of.end(); ++vi) { + if (!read_vertex(*vi)) + { +- std::cerr<<"SNC_io_parser::read: error in node line"<::read_items(int plus01) { + for(ei=Edge_of.begin(); ei!=Edge_of.end(); ++ei) { + if (!read_edge(*ei)) + { +- std::cerr<<"SNC_io_parser::read: error in edge line"<::read_items(int plus01) { + for(fi=Halffacet_of.begin(); fi!=Halffacet_of.end(); ++fi) { + if (!read_facet(*fi)) + { +- std::cerr<<"SNC_io_parser::read: error in facet line"<::read_items(int plus01) { + for(ci=Volume_of.begin()+plus01; ci!=Volume_of.end(); ++ci) { + if (!read_volume(*ci)) + { +- std::cerr<<"SNC_io_parser::read: error in volume line"<::read_items(int plus01) { + for(sei=SEdge_of.begin(); sei!=SEdge_of.end(); ++sei) { + if (!read_sedge(*sei)) + { +- std::cerr<<"SNC_io_parser::read: error in sedge line"<::read_items(int plus01) { + for(sli=SLoop_of.begin(); sli!=SLoop_of.end(); ++sli) { + if (!read_sloop(*sli)) + { +- std::cerr<<"SNC_io_parser::read: error in sloop line"<::read_items(int plus01) { + for(sfi=SFace_of.begin(); sfi!=SFace_of.end(); ++sfi) { + if (!read_sface(*sfi)) + { +- std::cerr<<"SNC_io_parser::read: error in sface line"<::read() + { + if ( !check_sep("Nef_polyhedron_S2") ) + { +- std::cerr<<"Missing line in header"<> vn)) ) + { +- std::cerr<<"SM_io_parser::read: wrong vertex line."<> en) && (en%2==0)) ) + { +- std::cerr<<"SM_io_parser::read: wrong edge line."<> ln)) ) + { +- std::cerr<<"SM_io_parser::read: wrong loop line."<> fn)) ) + { +- std::cerr<<"SM_io_parser::read: wrong face line."<::read() + for(i=0; i::read() + for(i=0; i +Date: Wed, 20 Jan 2021 08:38:33 +0100 +Subject: [PATCH 4/8] Fix typo and use setstate + +--- + Nef_2/include/CGAL/Nef_2/PM_io_parser.h | 10 ++-- + Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 66 +++++++++++------------ + Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h | 10 ++-- + 3 files changed, 43 insertions(+), 43 deletions(-) + +diff --git a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +index 52bc830e115..64a3e94916e 100644 +--- a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h ++++ b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +@@ -202,7 +202,7 @@ bool PM_io_parser::read_vertex(Vertex_handle v) + + if(!(f >= 0 && ((iso && f < fn) || (!iso && f < en)))) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + if (iso) v->set_face(Face_of[f]); +@@ -238,7 +238,7 @@ bool PM_io_parser::read_hedge(Halfedge_handle e) + if(!(eo >= 0 && (std::size_t) eo < en && epr >= 0 && (std::size_t) epr < en && ene >= 0 && (std::size_t) ene < en && + v >= 0 && (std::size_t) v < vn && f >= 0 && (std::size_t) f < fn )) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + std::cerr<<"wrong index in read_hedge"<::read_face(Face_handle f) + } + else + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + while (in >> ei) { + CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list."); + if (!(ei >= 0 && ei < en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + f->store_fc(Halfedge_of[ei]); +@@ -299,7 +299,7 @@ bool PM_io_parser::read_face(Face_handle f) + CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list."); + if (!(vi >= 0 && vi < vn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + f->store_iv(Vertex_of[vi]); +diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +index 21c54dd4133..e5530445153 100644 +--- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h ++++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +@@ -1402,7 +1402,7 @@ void SNC_io_parser::read() + if ( !check_sep("Selective Nef Complex") ) + { + CGAL_warning_msg(false, "SNC_io_parser::read: no SNC header."); +- returnl ++ return; + } + std::string kernel_type; + in >> kernel_type; +@@ -1581,14 +1581,14 @@ read_vertex(Vertex_handle vh) { + in >> index; + if(index >= int(en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->svertices_begin() = (index >= 0 ? Edge_of[index] : this->svertices_end()); + in >> index; + if(index >= int(en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->svertices_last() = index >= 0 ? Edge_of[index] : this->svertices_end(); +@@ -1596,14 +1596,14 @@ read_vertex(Vertex_handle vh) { + in >> index; + if(index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->shalfedges_begin() = index >= 0 ? SEdge_of[index] : this->shalfedges_end(); + in >> index; + if(index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->shalfedges_last() = index >= 0 ? SEdge_of[index] : this->shalfedges_end(); +@@ -1611,14 +1611,14 @@ read_vertex(Vertex_handle vh) { + in >> index; + if(index >= int(sfn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->sfaces_begin() = index >= 0 ? SFace_of[index] : this->sfaces_end(); + in >> index; + if(index >= int(sfn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->sfaces_last() = index >= 0 ? SFace_of[index] : this->sfaces_end(); +@@ -1626,7 +1626,7 @@ read_vertex(Vertex_handle vh) { + in >> index; + if(index >= int(sln)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + vh->shalfloop() = index >= 0 ? SLoop_of[index] : this->shalfloops_end(); +@@ -1685,7 +1685,7 @@ read_edge(Halfedge_handle eh) { + in >> index; + if(index < 0 || index >= int(en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + eh->twin() = Edge_of[index]; +@@ -1693,7 +1693,7 @@ read_edge(Halfedge_handle eh) { + in >> index; + if(index < 0 || index >= int(vn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + eh->center_vertex() = Vertex_of[index]; +@@ -1703,7 +1703,7 @@ read_edge(Halfedge_handle eh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + eh->out_sedge() = SEdge_of[index]; +@@ -1711,7 +1711,7 @@ read_edge(Halfedge_handle eh) { + in >> index; + if(index < 0 || index >= int(sfn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + eh->incident_sface() = SFace_of[index]; +@@ -1770,7 +1770,7 @@ read_facet(Halffacet_handle fh) { + in >> index; + if(index < 0 || index >= int(fn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + fh->twin() = Halffacet_of[index]; +@@ -1782,7 +1782,7 @@ read_facet(Halffacet_handle fh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + fh->boundary_entry_objects().push_back(make_object(SEdge_of[index])); +@@ -1795,7 +1795,7 @@ read_facet(Halffacet_handle fh) { + in >> index; + if(index < 0 || index >= int(sln)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + fh->boundary_entry_objects().push_back(make_object(SLoop_of[index])); +@@ -1805,7 +1805,7 @@ read_facet(Halffacet_handle fh) { + in >> index; + if(index < 0 || index >= int(vn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + fh->incident_volume() = Volume_of[index+addInfiBox]; +@@ -1852,7 +1852,7 @@ read_volume(Volume_handle ch) { + in >> index; + if(index < 0 || index >= int(sfn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + ch->shell_entry_objects().push_back(make_object(SFace_of[index])); +@@ -1907,7 +1907,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->twin() = SEdge_of[index]; +@@ -1915,7 +1915,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->sprev() = SEdge_of[index]; +@@ -1923,7 +1923,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->snext() = SEdge_of[index]; +@@ -1931,7 +1931,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->source() = Edge_of[index]; +@@ -1939,7 +1939,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sfn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->incident_sface() = SFace_of[index]; +@@ -1947,7 +1947,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->prev() = SEdge_of[index]; +@@ -1955,7 +1955,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(sen)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->next() = SEdge_of[index]; +@@ -1963,7 +1963,7 @@ read_sedge(SHalfedge_handle seh) { + in >> index; + if(index < 0 || index >= int(fn)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + seh->facet() = Halffacet_of[index]; +@@ -2018,7 +2018,7 @@ read_sloop(SHalfloop_handle slh) { + in >> index; + if(index < 0 || index >= sln) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + slh->twin() = SLoop_of[index]; +@@ -2026,7 +2026,7 @@ read_sloop(SHalfloop_handle slh) { + in >> index; + if(index < 0 || index >= sfn) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + slh->incident_sface() = SFace_of[index]; +@@ -2034,7 +2034,7 @@ read_sloop(SHalfloop_handle slh) { + in >> index; + if(index < 0 || index >= fn) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + slh->facet() = Halffacet_of[index]; +@@ -2085,7 +2085,7 @@ read_sface(SFace_handle sfh) { + in >> index; + if(index < 0 || index >= vn) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + sfh->center_vertex() = Vertex_of[index]; +@@ -2099,7 +2099,7 @@ read_sface(SFace_handle sfh) { + SM_decorator SD(&*sfh->center_vertex()); + if(index < 0 || index >= sen) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + SD.link_as_face_cycle(SEdge_of[index],sfh); +@@ -2112,7 +2112,7 @@ read_sface(SFace_handle sfh) { + in >> index; + if(index < 0 || index >= en) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + sfh->boundary_entry_objects().push_back(make_object(Edge_of[index])); +@@ -2126,7 +2126,7 @@ read_sface(SFace_handle sfh) { + in >> index; + if(index < 0 || index >= sln) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + sfh->boundary_entry_objects().push_back(make_object(SLoop_of[index])); +@@ -2137,7 +2137,7 @@ read_sface(SFace_handle sfh) { + in >> index; + if(index < 0 || index >= vn) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + sfh->volume() = Volume_of[index+addInfiBox]; +diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h +index a9377719f93..d58126bac9c 100644 +--- a/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h ++++ b/Nef_S2/include/CGAL/Nef_S2/SM_io_parser.h +@@ -205,7 +205,7 @@ bool SM_io_parser::read_vertex(SVertex_handle v) + + if(f<0 || (iso && f > fn) || (!iso && f > en)) + { +- in.clear(std::ios_base::badbit); ++ in.setstate(std::ios_base::badbit); + return false; + } + +@@ -246,7 +246,7 @@ bool SM_io_parser::read_edge(SHalfedge_handle e) + v >= 0 && v < vn && f >= 0 && f < fn )) + { + std::cerr<<"wrong index in read_edge"<::read_face(SFace_handle f) + if(!(ei >= 0 && ei < en)) + { + std::cerr<<"wrong index in face cycle list."<store_sm_boundary_object(Edge_of[ei],f); +@@ -326,7 +326,7 @@ bool SM_io_parser::read_face(SFace_handle f) + if(!(vi >= 0 && vi < vn)) + { + std::cerr<<"wrong index in iso vertex list."<store_sm_boundary_object(SVertex_of[vi],f); +@@ -336,7 +336,7 @@ bool SM_io_parser::read_face(SFace_handle f) + if(!(li >= 0 && li < 2)) + { + std::cerr<<"wrong index in iso vertex list."<store_sm_boundary_object(Loop_of[li],f); + +From ffa019712b0ad3b20e3d02edad4d731fda04a2ef Mon Sep 17 00:00:00 2001 +From: Maxime Gimeno +Date: Mon, 25 Jan 2021 12:59:48 +0100 +Subject: [PATCH 5/8] First face may be -1, don't fail on it, just don't use it + +--- + Nef_2/include/CGAL/Nef_2/PM_io_parser.h | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +index 64a3e94916e..d08b08180d6 100644 +--- a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h ++++ b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +@@ -280,11 +280,7 @@ bool PM_io_parser::read_face(Face_handle f) + { + f->set_halfedge(Halfedge_of[ei]); + } +- else +- { +- in.setstate(std::ios_base::badbit); +- return false; +- } ++ + while (in >> ei) { + CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list."); + if (!(ei >= 0 && ei < en)) + +From d78842712cdfcbb3bdfc5f7cb252d3772fd6a16f Mon Sep 17 00:00:00 2001 +From: Maxime Gimeno +Date: Tue, 26 Jan 2021 09:55:20 +0100 +Subject: [PATCH 6/8] Fix conversion warnigns + +--- + Nef_2/include/CGAL/Nef_2/PM_io_parser.h | 8 ++++---- + Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 18 +++++++++--------- + 2 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +index d08b08180d6..39b99b37d7c 100644 +--- a/Nef_2/include/CGAL/Nef_2/PM_io_parser.h ++++ b/Nef_2/include/CGAL/Nef_2/PM_io_parser.h +@@ -200,7 +200,7 @@ bool PM_io_parser::read_vertex(Vertex_handle v) + !(in >> p) || + !check_sep("}") ) return false; + +- if(!(f >= 0 && ((iso && f < fn) || (!iso && f < en)))) ++ if(!(f >= 0 && ((iso && (std::size_t)f < fn) || (!iso && (std::size_t)f < en)))) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -276,14 +276,14 @@ bool PM_io_parser::read_face(Face_handle f) + int n, ei, vi; Mark m; + if ( !(in >> n) || !check_sep("{") ) return false; + if ( !(in >> ei) || !check_sep(",") ) return false; +- if (ei >= 0 && ei < en) ++ if (ei >= 0 && (std::size_t) ei < en) + { + f->set_halfedge(Halfedge_of[ei]); + } + + while (in >> ei) { + CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list."); +- if (!(ei >= 0 && ei < en)) ++ if (!(ei >= 0 && (std::size_t)ei < en)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -293,7 +293,7 @@ bool PM_io_parser::read_face(Face_handle f) + if (!check_sep(",")) { return false; } + while (in >> vi) { + CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list."); +- if (!(vi >= 0 && vi < vn)) ++ if (!(vi >= 0 && (std::size_t)vi < vn)) + { + in.setstate(std::ios_base::badbit); + return false; +diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +index e5530445153..1dde7f8d0b3 100644 +--- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h ++++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +@@ -1579,7 +1579,7 @@ read_vertex(Vertex_handle vh) { + vh->sncp() = this->sncp(); + + in >> index; +- if(index >= int(en)) ++ if(index >= (int)en) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2016,7 +2016,7 @@ read_sloop(SHalfloop_handle slh) { + OK = OK && test_string("{"); + + in >> index; +- if(index < 0 || index >= sln) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2024,7 +2024,7 @@ read_sloop(SHalfloop_handle slh) { + slh->twin() = SLoop_of[index]; + OK = OK && test_string(","); + in >> index; +- if(index < 0 || index >= sfn) ++ if(index < 0 || index >= (int)(sfn)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2032,7 +2032,7 @@ read_sloop(SHalfloop_handle slh) { + slh->incident_sface() = SFace_of[index]; + OK = OK && test_string(","); + in >> index; +- if(index < 0 || index >= fn) ++ if(index < 0 || index >= (int)(fn)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2083,7 +2083,7 @@ read_sface(SFace_handle sfh) { + OK = OK && test_string("{"); + + in >> index; +- if(index < 0 || index >= vn) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2097,7 +2097,7 @@ read_sface(SFace_handle sfh) { + in >> index; + // sfh->boundary_entry_objects().push_back(SEdge_of[index]); + SM_decorator SD(&*sfh->center_vertex()); +- if(index < 0 || index >= sen) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2110,7 +2110,7 @@ read_sface(SFace_handle sfh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; +- if(index < 0 || index >= en) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2124,7 +2124,7 @@ read_sface(SFace_handle sfh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; +- if(index < 0 || index >= sln) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2135,7 +2135,7 @@ read_sface(SFace_handle sfh) { + } + + in >> index; +- if(index < 0 || index >= vn) ++ if(index < 0 || index >= (int)(sln)) + { + in.setstate(std::ios_base::badbit); + return false; + +From 23cc6b0f4a2ac6061b01d86411d58b6da7ff5a34 Mon Sep 17 00:00:00 2001 +From: Maxime Gimeno +Date: Wed, 27 Jan 2021 10:04:45 +0100 +Subject: [PATCH 7/8] Fix read_sface + +--- + .../Convex_decomposition_3/check_decomposition.cpp | 2 ++ + Nef_3/include/CGAL/Nef_3/SNC_io_parser.h | 10 +++++----- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +index 1dde7f8d0b3..a31a07c5d99 100644 +--- a/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h ++++ b/Nef_3/include/CGAL/Nef_3/SNC_io_parser.h +@@ -1803,7 +1803,7 @@ read_facet(Halffacet_handle fh) { + } + + in >> index; +- if(index < 0 || index >= int(vn)) ++ if(index < 0 || index >= int(cn)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2083,7 +2083,7 @@ read_sface(SFace_handle sfh) { + OK = OK && test_string("{"); + + in >> index; +- if(index < 0 || index >= (int)(sln)) ++ if(index < 0 || index >= (int)(vn)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2097,7 +2097,7 @@ read_sface(SFace_handle sfh) { + in >> index; + // sfh->boundary_entry_objects().push_back(SEdge_of[index]); + SM_decorator SD(&*sfh->center_vertex()); +- if(index < 0 || index >= (int)(sln)) ++ if(index < 0 || index >= (int)(sen)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2110,7 +2110,7 @@ read_sface(SFace_handle sfh) { + while(isdigit(cc)) { + in.putback(cc); + in >> index; +- if(index < 0 || index >= (int)(sln)) ++ if(index < 0 || index >= (int)(en)) + { + in.setstate(std::ios_base::badbit); + return false; +@@ -2135,7 +2135,7 @@ read_sface(SFace_handle sfh) { + } + + in >> index; +- if(index < 0 || index >= (int)(sln)) ++ if(index < 0 || index >= (int)(cn)) + { + in.setstate(std::ios_base::badbit); + return false; + -- cgit v1.2.3