From 9696393c5b972d6a22dcfba5a5fd610e609fff1e Mon Sep 17 00:00:00 2001 From: Andrey Tuganov Date: Wed, 8 Mar 2017 12:06:31 -0500 Subject: [PATCH] Fix nullptr dereferencing in val_fixtures.cpp --- test/val/val_fixtures.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/val/val_fixtures.cpp b/test/val/val_fixtures.cpp index eb9527c..c72cbf5 100644 --- a/test/val/val_fixtures.cpp +++ b/test/val/val_fixtures.cpp @@ -82,7 +82,8 @@ spv_result_t ValidateBase::ValidateAndRetrieveValidationState( template std::string ValidateBase::getDiagnosticString() { - return std::string(diagnostic_->error); + return diagnostic_ == nullptr ? + std::string() : std::string(diagnostic_->error); } template @@ -92,7 +93,7 @@ spv_validator_options ValidateBase::getValidatorOptions() { template spv_position_t ValidateBase::getErrorPosition() { - return diagnostic_->position; + return diagnostic_ == nullptr ? spv_position_t() : diagnostic_->position; } template class spvtest::ValidateBase; -- 2.7.4