File: Add-CGAL-set_warning_behaviour-for-issue-3935.patch

package info (click to toggle)
openscad 2021.01-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,096 kB
  • sloc: cpp: 53,199; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 118
file content (32 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Kristian Nielsen <knielsen@knielsen-hq.org>
Date: Tue, 15 Feb 2022 22:17:42 +0100
Subject: Add-CGAL-set_warning_behaviour-for-issue-3935

Backport an upstream patch to work with newer CGAL. This is necessary
due to a security fix for CGAL, which changed behaviour for invalid
input that are tested in the OpenSCAD testsuite.

Origin: https://github.com/openscad/openscad/pull/3936
Bug: https://github.com/openscad/openscad/issues/3935
Forwarded: not-needed
---
 src/openscad.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/openscad.cc b/src/openscad.cc
index 3c46cda..6c2a00c 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -924,9 +924,9 @@ int main(int argc, char **argv)
 #endif
 
 #ifdef ENABLE_CGAL
-	// Causes CGAL errors to abort directly instead of throwing exceptions
-	// (which we don't catch). This gives us stack traces without rerunning in gdb.
-	CGAL::set_error_behaviour(CGAL::ABORT);
+	// Always throw exceptions from CGAL, so we can catch instead of crashing on bad geometry.
+	CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
+	CGAL::set_warning_behaviour(CGAL::THROW_EXCEPTION);
 #endif
 	Builtins::instance()->initialize();