PostGIS  2.1.10dev-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

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 728 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(), LWGEOMFromWKB(), rt_raster_gdal_polygonize(), and rt_raster_gdal_rasterize().

729 {
731 
732  /* Initialize the state appropriately */
733  s.wkb = wkb;
734  s.wkb_size = wkb_size;
735  s.swap_bytes = LW_FALSE;
736  s.check = check;
737  s.lwtype = 0;
738  s.srid = SRID_UNKNOWN;
739  s.has_z = LW_FALSE;
740  s.has_m = LW_FALSE;
741  s.has_srid = LW_FALSE;
742  s.pos = wkb;
743 
744  /* Hand the check catch-all values */
745  if ( check & LW_PARSER_CHECK_NONE )
746  s.check = 0;
747  else
748  s.check = check;
749 
750  return lwgeom_from_wkb_state(&s);
751 }
uint32_t lwtype
Definition: lwin_wkb.c:24
const uint8_t * wkb
Definition: lwin_wkb.c:20
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
size_t wkb_size
Definition: lwin_wkb.c:21
#define LW_FALSE
Definition: liblwgeom.h:52
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
char * s
Definition: cu_in_wkt.c:24
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:632
uint32_t srid
Definition: lwin_wkb.c:25
Used for passing the parse state between the parsing functions.
Definition: lwin_wkb.c:18
const uint8_t * pos
Definition: lwin_wkb.c:29

Here is the call graph for this function:

Here is the caller graph for this function: