Skip to content

Commit dd9d8d2

Browse files
yeesianvisr
authored andcommitted
check bounds for interiorRing(...)
1 parent ce017e7 commit dd9d8d2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/geos_functions.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,9 @@ end
11021102
# Return NULL on exception, Geometry must be a Polygon.
11031103
# Returned object is a pointer to internal storage: it must NOT be destroyed directly.
11041104
function interiorRing(ptr::GEOSGeom, n::Integer, context::GEOSContext = _context)
1105+
if !(0 < n <= numInteriorRings(ptr, context))
1106+
error("LibGEOS: n=$n is out of bounds for Polygon with $(numInteriorRings(ptr, context)) interior ring(s)")
1107+
end
11051108
result = GEOSGetInteriorRingN_r(context.ptr, ptr, n - 1)
11061109
if result == C_NULL
11071110
error("LibGEOS: Error in GEOSGetInteriorRingN")

0 commit comments

Comments
 (0)