PostGIS  2.3.7dev-r@@SVN_REVISION@@
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
checkparser check flags, see LW_PARSER_CHECK_* macros
sizelength of WKB byte buffer
wkbWKB byte buffer

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 765 of file lwin_wkb.c.

References wkb_parse_state::check, wkb_parse_state::has_m, wkb_parse_state::has_srid, wkb_parse_state::has_z, LW_FALSE, LW_PARSER_CHECK_NONE, lwgeom_from_wkb_state(), wkb_parse_state::lwtype, wkb_parse_state::pos, s, wkb_parse_state::srid, SRID_UNKNOWN, wkb_parse_state::swap_bytes, wkb_parse_state::wkb, and wkb_parse_state::wkb_size.

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

766 {
768 
769  /* Initialize the state appropriately */
770  s.wkb = wkb;
771  s.wkb_size = wkb_size;
772  s.swap_bytes = LW_FALSE;
773  s.check = check;
774  s.lwtype = 0;
775  s.srid = SRID_UNKNOWN;
776  s.has_z = LW_FALSE;
777  s.has_m = LW_FALSE;
778  s.has_srid = LW_FALSE;
779  s.pos = wkb;
780 
781  /* Hand the check catch-all values */
782  if ( check & LW_PARSER_CHECK_NONE )
783  s.check = 0;
784  else
785  s.check = check;
786 
787  return lwgeom_from_wkb_state(&s);
788 }
uint32_t lwtype
Definition: lwin_wkb.c:41
const uint8_t * wkb
Definition: lwin_wkb.c:37
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1985
size_t wkb_size
Definition: lwin_wkb.c:38
#define LW_FALSE
Definition: liblwgeom.h:76
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
char * s
Definition: cu_in_wkt.c:23
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:669
uint32_t srid
Definition: lwin_wkb.c:42
Used for passing the parse state between the parsing functions.
Definition: lwin_wkb.c:35
const uint8_t * pos
Definition: lwin_wkb.c:46

Here is the call graph for this function:

Here is the caller graph for this function: