]> granicus.if.org Git - postgis/commitdiff
Catch un-defaulted final parameter
authorPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 25 Mar 2019 18:20:10 +0000 (18:20 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Mon, 25 Mar 2019 18:20:10 +0000 (18:20 +0000)
References #4353

git-svn-id: http://svn.osgeo.org/postgis/trunk@17358 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos.c

index 692afed6a2423de34f4b8e4a04d8d2be853e555c..8d13abda0d49abeb2911c5cdd64b5ee48113fba8 100644 (file)
@@ -806,7 +806,17 @@ Datum buffer(PG_FUNCTION_ARGS)
 
        GSERIALIZED     *geom1 = PG_GETARG_GSERIALIZED_P(0);
        double size = PG_GETARG_FLOAT8(1);
-       text *params_text = PG_GETARG_TEXT_P(2);
+       text *params_text;
+
+       if (PG_NARGS() > 2)
+       {
+               params_text = PG_GETARG_TEXT_P(2);
+       }
+       else
+       {
+               params_text = palloc(VARHDRSZ);
+               SET_VARSIZE(params_text, 0);
+       }
 
        /* Empty.Buffer() == Empty[polygon] */
        if ( gserialized_is_empty(geom1) )