PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_from_wkb()

LWGEOM* lwgeom_from_wkb ( const uint8_t *  wkb,
const size_t  wkb_size,
const char  check 
)

WKB inputs must have a declared size, to prevent malformed WKB from reading off the end of the memory segment (this stops a malevolent user from declaring a one-ring polygon to have 10 rings, causing the WKB reader to walk off the end of the memory).

Parameters
wkb_sizelength of WKB byte buffer
wkbWKB byte buffer
checkparser check flags, see LW_PARSER_CHECK_* macros

Check is a bitmask of: LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD, LW_PARSER_CHECK_CLOSURE, LW_PARSER_CHECK_NONE, LW_PARSER_CHECK_ALL

Definition at line 842 of file lwin_wkb.c.

843 {
845 
846  /* Initialize the state appropriately */
847  s.wkb = wkb;
848  s.wkb_size = wkb_size;
849  s.swap_bytes = LW_FALSE;
850  s.check = check;
851  s.lwtype = 0;
852  s.srid = SRID_UNKNOWN;
853  s.has_z = LW_FALSE;
854  s.has_m = LW_FALSE;
855  s.has_srid = LW_FALSE;
856  s.error = LW_FALSE;
857  s.pos = wkb;
858  s.depth = 1;
859 
860  if (!wkb || !wkb_size)
861  return NULL;
862 
863  return lwgeom_from_wkb_state(&s);
864 }
char * s
Definition: cu_in_wkt.c:23
#define LW_FALSE
Definition: liblwgeom.h:94
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:215
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:743
Used for passing the parse state between the parsing functions.
Definition: lwin_wkb.c:40

References LW_FALSE, lwgeom_from_wkb_state(), s, and SRID_UNKNOWN.

Referenced by cu_wkb_in(), geography_from_binary(), geography_recv(), lwgeom_from_hexwkb(), LWGEOM_from_WKB(), LWGEOM_in(), LWGEOM_recv(), LWGEOMFromEWKB(), rt_raster_gdal_contour(), rt_raster_gdal_polygonize(), test_geos_makevalid(), and test_wkb_fuzz().

Here is the call graph for this function:
Here is the caller graph for this function: