PostGIS  2.5.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).

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 770 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, 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(), rt_raster_gdal_rasterize(), and test_geos_makevalid().

771 {
773 
774  /* Initialize the state appropriately */
775  s.wkb = wkb;
776  s.wkb_size = wkb_size;
777  s.swap_bytes = LW_FALSE;
778  s.check = check;
779  s.lwtype = 0;
780  s.srid = SRID_UNKNOWN;
781  s.has_z = LW_FALSE;
782  s.has_m = LW_FALSE;
783  s.has_srid = LW_FALSE;
784  s.pos = wkb;
785 
786  return lwgeom_from_wkb_state(&s);
787 }
uint32_t lwtype
Definition: lwin_wkb.c:42
const uint8_t * wkb
Definition: lwin_wkb.c:38
size_t wkb_size
Definition: lwin_wkb.c:39
#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:674
uint32_t srid
Definition: lwin_wkb.c:43
Used for passing the parse state between the parsing functions.
Definition: lwin_wkb.c:36
const uint8_t * pos
Definition: lwin_wkb.c:47
Here is the call graph for this function:
Here is the caller graph for this function: