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

 
 

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

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Sun 16 Jun 2019 06:43:55 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  Patch Submitted Assigned to:  Philip Nienhuis <philipnienhuis>
Originator Name:  Philip Nienhuis Open/Closed:  Open
Release:  other Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.

 

(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 philipnienhuis (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.5