PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_wkb_fuzz()

static void test_wkb_fuzz ( void  )
static

Definition at line 231 of file cu_in_wkb.c.

232 {
233  /* OSS-FUZZ https://trac.osgeo.org/postgis/ticket/4534 */
234  uint8_t wkb[36] = {000, 000, 000, 000, 015, 000, 000, 000, 003, 000, 200, 000, 000, 010, 000, 000, 000, 000,
235  000, 000, 000, 000, 010, 000, 000, 000, 000, 000, 000, 000, 000, 010, 000, 000, 000, 000};
237  lwgeom_free(g);
238 
239  /* OSS-FUZZ https://trac.osgeo.org/postgis/ticket/4536 */
240  uint8_t wkb2[319] = {
241  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
242  001, 001, 001, 001, 001, 012, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
243  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 051, 001, 001,
244  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
245  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 115, 001, 001, 001, 001,
246  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 001, 001, 001, 001, 001, 001, 001,
247  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
248  001, 001, 001, 001, 001, 001, 000, 000, 000, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
249  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 002,
250  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
251  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 207, 001,
252  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
253  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 000, 000, 000, 000,
254  000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 001,
255  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
256  001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001};
257  g = lwgeom_from_wkb(wkb2, 319, LW_PARSER_CHECK_NONE);
258  lwgeom_free(g);
259 
260  /* OSS-FUZZ: https://trac.osgeo.org/postgis/ticket/4535 */
261  uint8_t wkb3[9] = {0x01, 0x03, 0x00, 0x00, 0x10, 0x8d, 0x55, 0xf3, 0xff};
263  lwgeom_free(g);
264 
265  /* OSS-FUZZ: https://trac.osgeo.org/postgis/ticket/4621 */
266  uint32_t big_size = 20000000;
267  uint8_t *wkb5 = lwalloc(big_size);
268  memset(wkb5, 0x01, big_size);
269  g = lwgeom_from_wkb(wkb5, big_size, LW_PARSER_CHECK_NONE);
270  lwgeom_free(g);
271  lwfree(wkb5);
272 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
void lwfree(void *mem)
Definition: lwutil.c:242
void * lwalloc(size_t size)
Definition: lwutil.c:227
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...
Definition: lwin_wkb.c:825

References LW_PARSER_CHECK_NONE, lwalloc(), lwfree(), lwgeom_free(), and lwgeom_from_wkb().

Referenced by wkb_in_suite_setup().

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