Added a check for correct order of ``from'' and ``to'' args in line_substring()
authorSandro Santilli <strk@keybit.net>
Thu, 9 Jun 2005 12:30:45 +0000 (12:30 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 9 Jun 2005 12:30:45 +0000 (12:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1746 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_functions_analytic.c

index 1ac2b0abe04543b26e507bfb66c2630041a437a5..096668fafd3dfaeda197d3e678948e6b017e902d 100644 (file)
@@ -877,6 +877,11 @@ Datum LWGEOM_line_substring(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
        }
 
+       if ( from > to ) {
+               elog(ERROR, "2nd arg must be smaller then 3rd arg");
+               PG_RETURN_NULL();
+       }
+
        if( lwgeom_getType(geom->type) != LINETYPE ) {
                elog(ERROR,"line_interpolate_point: 1st arg isnt a line");
                PG_RETURN_NULL();