PostGIS  3.0.6dev-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
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 825 of file lwin_wkb.c.

826 {
828 
829  /* Initialize the state appropriately */
830  s.wkb = wkb;
831  s.wkb_size = wkb_size;
832  s.swap_bytes = LW_FALSE;
833  s.check = check;
834  s.lwtype = 0;
835  s.srid = SRID_UNKNOWN;
836  s.has_z = LW_FALSE;
837  s.has_m = LW_FALSE;
838  s.has_srid = LW_FALSE;
839  s.error = LW_FALSE;
840  s.pos = wkb;
841  s.depth = 1;
842 
843  if (!wkb || !wkb_size)
844  return NULL;
845 
846  return lwgeom_from_wkb_state(&s);
847 }
char * s
Definition: cu_in_wkt.c:23
#define LW_FALSE
Definition: liblwgeom.h:108
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:726
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_polygonize(), test_geos_makevalid(), and test_wkb_fuzz().

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