PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_wkb_fuzz()

static void test_wkb_fuzz ( void  )
static

Definition at line 233 of file cu_in_wkb.c.

234{
235 /* OSS-FUZZ https://trac.osgeo.org/postgis/ticket/4534 */
236 uint8_t wkb[36] = {000, 000, 000, 000, 015, 000, 000, 000, 003, 000, 200, 000, 000, 010, 000, 000, 000, 000,
237 000, 000, 000, 000, 010, 000, 000, 000, 000, 000, 000, 000, 000, 010, 000, 000, 000, 000};
239 lwgeom_free(g);
240
241 /* OSS-FUZZ https://trac.osgeo.org/postgis/ticket/4536 */
242 uint8_t wkb2[319] = {
243 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
244 001, 001, 001, 001, 001, 012, 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, 001, 001, 001, 051, 001, 001,
246 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
247 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 115, 001, 001, 001, 001,
248 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 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, 001,
250 001, 001, 001, 001, 001, 001, 000, 000, 000, 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, 001, 002,
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, 001, 001, 001, 207, 001,
254 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
255 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 000, 000, 000, 000, 000,
256 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 001,
257 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001,
258 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001, 001};
260 lwgeom_free(g);
261
262 /* OSS-FUZZ: https://trac.osgeo.org/postgis/ticket/4535 */
263 uint8_t wkb3[9] = {0x01, 0x03, 0x00, 0x00, 0x10, 0x8d, 0x55, 0xf3, 0xff};
265 lwgeom_free(g);
266
267 /* OSS-FUZZ: https://trac.osgeo.org/postgis/ticket/4544 */
268 uint8_t wkb4[22] = {0x01, 0x0f, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00,
269 0x00, 0x00, 0x11, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00};
271 lwgeom_free(g);
272
273 /* OSS-FUZZ: https://trac.osgeo.org/postgis/ticket/4621 */
274 uint32_t big_size = 20000000;
275 uint8_t *wkb5 = lwalloc(big_size);
276 memset(wkb5, 0x01, big_size);
277 g = lwgeom_from_wkb(wkb5, big_size, LW_PARSER_CHECK_NONE);
278 lwgeom_free(g);
279 lwfree(wkb5);
280}
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:248
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:842

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: