[openscad] Added fix for issue 267
Miro Hrončok
churchyard at fedoraproject.org
Sun Feb 3 02:28:43 UTC 2013
commit b8cddad47d80fe563215de93a51c4fc45afaf74e
Author: Miro Hrončok <miro at hroncok.cz>
Date: Sun Feb 3 03:28:18 2013 +0100
Added fix for issue 267
openscad-pull268.patch | 132 ++++++++++++++++++++++++++++++++++++++++++++++++
openscad.spec | 8 +++-
2 files changed, 139 insertions(+), 1 deletions(-)
---
diff --git a/openscad-pull268.patch b/openscad-pull268.patch
new file mode 100644
index 0000000..876f582
--- /dev/null
+++ b/openscad-pull268.patch
@@ -0,0 +1,132 @@
+From 757820fe1c67290328c77802ea7718505b77f437 Mon Sep 17 00:00:00 2001
+From: Justin C <charetjc at gmail.com>
+Date: Sat, 2 Feb 2013 02:11:42 -0800
+Subject: [PATCH 1/2] missing NULL check when normalization exceeds limit for
+ elements
+
+---
+ src/csgtermnormalizer.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc
+index e2474e9..81fab80 100644
+--- a/src/csgtermnormalizer.cc
++++ b/src/csgtermnormalizer.cc
+@@ -20,7 +20,7 @@
+ PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit);
+ // Clean up any partially evaluated terms
+ shared_ptr<CSGTerm> newroot = root, tmproot;
+- while (newroot != tmproot) {
++ while (newroot && newroot != tmproot) {
+ tmproot = newroot;
+ newroot = collapse_null_terms(tmproot);
+ }
+--
+1.7.10
+
+
+From 96903036fdf6612d94f0211171da76f3a5450e3d Mon Sep 17 00:00:00 2001
+From: Justin C <charetjc at gmail.com>
+Date: Sat, 2 Feb 2013 02:12:56 -0800
+Subject: [PATCH 2/2] add test sample for issue #267
+
+---
+ .../scad/bugs/issue267-normalization-crash.scad | 86 ++++++++++++++++++++
+ 1 file changed, 86 insertions(+)
+ create mode 100644 testdata/scad/bugs/issue267-normalization-crash.scad
+
+diff --git a/testdata/scad/bugs/issue267-normalization-crash.scad b/testdata/scad/bugs/issue267-normalization-crash.scad
+new file mode 100644
+index 0000000..e4e3d87
+--- /dev/null
++++ b/testdata/scad/bugs/issue267-normalization-crash.scad
+@@ -0,0 +1,86 @@
++/*
++ * Reported by Justin Charette
++ * Causes a crash in CSGTermNormalizer::normalize() when CSG element count
++ * exceeds limit setting in preferences (verified with default value of 2000).
++ */
++
++
++$fn=20;
++
++/* donut (r1, r2, t) {{{
++ r1 = radius of torus
++ r2 = radius of torus cross section (circle)
++ t = thickness of shell (t == 0 is
++*/
++module donut (r1, r2, t=0) {
++ difference() {
++ rotate_extrude( convexity=6 ) {
++ translate([r1, 0, 0]) {
++ circle( r = r2 );
++ }
++ }
++ // (t == 0 ? solid : hollow )
++ if (t > 0) {
++ rotate_extrude( convexity=6 ) {
++ translate([r1, 0, 0]) {
++ circle( r = r2-t );
++ }
++ }
++ }
++ }
++} //}}}
++
++/* half donut (r1, r2, t, round) {{{
++ r1 = radius of torus
++ r2 = radius of torus cross section (circle)
++ t = thickness of shell
++ round = trim ends of semi-torus so they are round
++*/
++module half_donut (r1, r2, t=1, round=false) {
++ difference() {
++ donut( r1, r2, t );
++ difference() {
++ translate( [0, -((r1+r2)/2+0.5), 0] )
++ scale( [2*(r1+r2)+1, r1+r2+1, 2*r2+1] )
++ square( 1, center=true );
++ if (round) {
++ rotate( 90, [0, 1, 0] )
++ cylinder( 2*(r1+r2)+2, r2, r2, center=true );
++ }
++ }
++ }
++} //}}}
++
++/* donut flange (r1, r2, a1, a2, a_step, t, round) {{{
++ r1 = radius of torus
++ r2 = radius of torus cross section (circle)
++ a1 = starting angle of flange rotation
++ a2 = stopping angle of flange rotation
++ a_step = increment size of flange rotation
++ t = thickness of shell (t == 0 is solid, t in (0, r2) is hollow)
++ round = (true/false) to trim ends of semi-torus so they are round
++*/
++module donut_flange (r1, r2, a1, a2, a_step=1, t=0, round=false) {
++ difference() {
++ union() {
++ for (a = [a1:a_step:a2]) {
++ rotate( a, [1, 0, 0] )
++ half_donut( r1, r2, round );
++ }
++ }
++ // (t == 0 ? solid : hollow )
++ if (t > 0) {
++ union() {
++ for (a = [a1:a_step:a2]) {
++ rotate( a, [1, 0, 0] )
++ half_donut( r1, r2-t, round );
++ }
++ }
++ }
++ }
++} //}}}
++
++donut( 20, 5 );
++donut_flange( 20, 5, 0, 50, 10, t=1, round=false );
++
++// vim: set et sw=2 ts=2 sts=2 ai sta sr fdm=marker:
+--
+1.7.10
+
diff --git a/openscad.spec b/openscad.spec
index 3faf743..63a042c 100644
--- a/openscad.spec
+++ b/openscad.spec
@@ -1,7 +1,7 @@
Name: openscad
%global shortversion 2013.01
Version: %{shortversion}.17
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: The Programmers Solid 3D CAD Modeller
# COPYING contains a linking exception for CGAL
License: GPLv2 with exceptions
@@ -9,6 +9,8 @@ Group: Applications/Engineering
URL: http://www.openscad.org/
Source0: https://openscad.googlecode.com/files/%{name}-%{shortversion}.src.tar.gz
Patch0: %{name}-tests-cmake-glewfix.patch
+# https://github.com/openscad/openscad/pull/268
+Patch1: %{name}-pull268.patch
BuildRequires: qt-devel >= 4.4
BuildRequires: bison >= 2.4
BuildRequires: flex >= 2.5.35
@@ -34,6 +36,7 @@ interested in creating computer-animated movies.
%prep
%setup -qn %{name}-%{shortversion}
%patch0 -p1
+%patch1 -p1
%build
qmake-qt4 VERSION=%{shortversion} PREFIX=%{_prefix}
@@ -73,6 +76,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/libraries/MCAD
%{_mandir}/man1/*
%changelog
+* Sun Feb 03 2013 Miro Hrončok <mhroncok at redhat.com> - 2013.01.17-3
+- Added fix for issue 267
+
* Tue Jan 22 2013 Miro Hrončok <mhroncok at redhat.com> - 2013.01.17-2
- Using source tarball
- Reffer to the shorter version in the app
More information about the scm-commits
mailing list