[Bug 4311] Crash on a loft command with incorrect input.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
chennes
Veteran
Posts: 3607
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [Bug 4311] Crash on a loft command with incorrect input.

Post by chennes »

This is a bug in OpenCascade (and is still present in 7.5.0). In BRepOffsetAPI_ThruSections.cxx, lines 482-499 are

Code: Select all

try {
    // Calculate the resulting shape
    if (myWires.Length() == 2 || myIsRuled) {
      // create a ruled shell
      CreateRuled();
    }
    else {
      // create a smoothed shell
      CreateSmoothed();
    }
  }
  catch (Standard_Failure const&)
  {
    NotDone();
    return;
  }
  // Encode the Regularities
  BRepLib::EncodeRegularity(myShape);
When you only have the first two sections selected, it creates a ruled surface. This fails due to a zero-length normal, which throws an exception. That exception is nicely caught, calls NotDone(), and returns without ever calling BRepLib::EncodeRegularity(myShape);. However, CreateSmoothed() fails without an exception, it just returns when it detects that it can't make the shell. So the catch is never hit, and EncodeRegularity is called. It proceeds to try to use the TShape without ever checking it for null. And we die.

Is this something we should try to code around by doing our own detection, or just file an upstream bug report?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 51193
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug 4311] Crash on a loft command with incorrect input.

Post by chrisb »

Moved to developers corner.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Kunda1
Veteran
Posts: 13447
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Bug 4311] Crash on a loft command with incorrect input.

Post by Kunda1 »

Hi @chennes, thanks for posting. Just a quick request. Please link back tot he bug using the bug bbcode in your OP.
Example: issue #4311. This makes it more convenient and helps keep forum threads about bugs organized.
My bad! it was part of a longer post. duh :oops: Please disregard
Thanks again!

Edit: my bad
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply