bugGNU Octave - Bugs: bug #56506, [octave forge] (geometry)...

 
 

bug #56506: [octave forge] (geometry) clpPolygon_mrf crashes on non-overlapping polygons

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Sun 16 Jun 2019 06:43:55 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 21 Nov 2019 07:51:11 PM UTC, comment #4: 
Philip Nienhuis <philipnienhuis>
Group Member
Tue 13 Aug 2019 07:50:32 PM UTC, comment #3: 

Hmmm, that polishing is done in the m-file wrapper, so the submitted patch in comment #1 will just do.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 09 Aug 2019 09:16:09 AM UTC, comment #2: 

A little more polishing to do:
empty output should rather be [](0x2) as in:

>> [outpol, f] = clipPolygon_clipper (subpol, clppol2, 1)
outpol = [](0x2)
f = 0


instead of

>> [outpol, f] = clipPolygon_mrf (subpol, clppol2, 1)
outpol = [](0x0)
f = 0


to allow adding results to a list of polygons (-vertices).

I'll come up with a revised cset later on.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 21 Jun 2019 06:19:50 PM UTC, comment #1: 

Indeed, the issue was integer overflow after subtracting 1 from a zero-valued octave_idx_type.
Now I get:

>> subpol = [0 0; 5 5; 2.5 4;0 0];
>> clppol2 = [10 1; 16 6; 13.5 5; 10 1];
>> [outpol, f] = clipPolygon_mrf (subpol, clppol2, 1)
outpol = [](0x0)
f = 0


cset attached. I hope it's not too much of a kludge.

@JuanPi:
BTW, in this case polybool_mrf.oct returns a [](0x0) value for the output polygon.  Wouldn't you think it better returns a [](0x2) empty array?  I can imagine some script concatenating output polygons from boolean operations and that would error out if it tried to add this 0x0 empty value to an Nx2 array.
I leave to you to decide (and optionally adapt polygon_mrf.cc).


(file #47119)

Philip Nienhuis <philipnienhuis>
Group Member
Sun 16 Jun 2019 06:43:55 PM UTC, original submission:  

... when invoking the AND boolean operation:

>> subpol = [0 0; 5 5; 2.5 4;0 0];
>> clppol = [1 1; 6 6; 3.5 5; 1 1];
## First with these overlapping polygons ...
>> [outpol, f] = clipPolygon_mrf (subpol, clppol, 1)
outpol =
   3.0000   4.2000
   1.0000   1.0000
   5.0000   5.0000

f =  1
## Create disjoint clip polygon. With that ...
>> clppol2 = [10 1; 16 6; 13.5 5; 10 1];
>> [outpol, f] = clipPolygon_mrf (subpol, clppol2, 1)
error: out of memory or dimension too large for Octave's index type
error: called from
    clipPolygon_mrf at line 104 column 16
>>


I suspect something along the lines of compiled function polybool_mrf() not checking for empty output polygons from the boolean operations before copying internal results to output variables. The only boolean operation where empty output can appear at all is AND.
(The Clipper library doesn't have this bug.)

cc-ing package maintainer.

Philip Nienhuis <philipnienhuis>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #47119:  bug#56506_polybool_mrf.cset added by philipnienhuis (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by philipnienhuis (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-28 siko1056 Summary[octave-forge] (geometry) clpPolygon_mrf crashes on non-overlapping polygons [octave forge] (geometry) clpPolygon_mrf crashes on non-overlapping polygons
    2019-11-21 philipnienhuis StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2019-06-21 philipnienhuis Attached File- Added bug #56506_polybool_mrf.cset, #47119
        StatusNone Patch Submitted
        Assigned tojuanpi philipnienhuis

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code