PostGIS  3.4.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 834 of file lwin_wkb.c.

835 {
837 
838  /* Initialize the state appropriately */
839  s.wkb = wkb;
840  s.wkb_size = wkb_size;
841  s.swap_bytes = LW_FALSE;
842  s.check = check;
843  s.lwtype = 0;
844  s.srid = SRID_UNKNOWN;
845  s.has_z = LW_FALSE;
846  s.has_m = LW_FALSE;
847  s.has_srid = LW_FALSE;
848  s.error = LW_FALSE;
849  s.pos = wkb;
850  s.depth = 1;
851 
852  if (!wkb || !wkb_size)
853  return NULL;
854 
855  return lwgeom_from_wkb_state(&s);
856 }
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:735
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: