From e78c3980267d594bb1e745654818139835bbb826 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Thu, 19 Mar 2015 16:40:50 +0100 Subject: [PATCH] gmio_stl: fix crash in case input gmio_transfer is null in gmio_stlb_read() --- src/gmio_stl/stlb_read.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gmio_stl/stlb_read.c b/src/gmio_stl/stlb_read.c index a3ffddf..a19b702 100644 --- a/src/gmio_stl/stlb_read.c +++ b/src/gmio_stl/stlb_read.c @@ -72,7 +72,10 @@ int gmio_stlb_read(gmio_stl_mesh_creator_t *creator, const gmio_endianness_t byte_order = options != NULL ? options->byte_order : host_byte_order; const uint32_t max_facet_count_per_read = - gmio_size_to_uint32(trsf->buffer_size / GMIO_STLB_TRIANGLE_RAWSIZE); + trsf != NULL ? + gmio_size_to_uint32( + trsf->buffer_size / GMIO_STLB_TRIANGLE_RAWSIZE) + : 0; gmio_stlb_readwrite_helper_t rparams = {0}; uint8_t header_data[GMIO_STLB_HEADER_SIZE]; uint32_t total_facet_count = 0; /* Count of facets as declared in the stream */