Check for nullptr in call to properties, fixes segfault. (#106)

* Added -fPIE as g++ 9.4.0 complained and would not link

* Prevent crash by checking for properties before dereferencing.

---------

Co-authored-by: Tim Finer <finert@pixia.com>
This commit is contained in:
Tim Finer
2023-05-23 09:47:45 -07:00
committed by GitHub
co-authored by Tim Finer
parent 20eb9c8dae
commit 0422d77bbe
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ SHELL = /bin/sh
# inherit from env if set
CC := $(CC)
CXX := $(CXX)
CFLAGS := $(CFLAGS)
CXXFLAGS := $(CXXFLAGS) -std=c++17
CFLAGS := $(CFLAGS) -fPIE
CXXFLAGS := $(CXXFLAGS) -std=c++17 -fPIE
LDFLAGS := $(LDFLAGS)
WARNING_FLAGS := -Wall -Wshadow -Wsign-compare -Wextra -Wunreachable-code -Wuninitialized -Wshadow
RELEASE_FLAGS := -O3 -DNDEBUG
+1 -1
View File
@@ -151,7 +151,7 @@ void readFeature(const FlatGeobuf::Feature *feature, long long feature_sequence_
// assume tabular schema with columns in header
size_t p_pos = 0;
while (p_pos < feature->properties()->size()) {
while (feature->properties() && p_pos < feature->properties()->size()) {
uint16_t col_idx;
memcpy(&col_idx, feature->properties()->data() + p_pos, sizeof(col_idx));