From 2addc7763556ff76809f14e2063d1452aa9d6275 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sat, 3 Aug 2024 17:29:33 -0400 Subject: Fix crash for empty/invalid/not-found filepaths Add tests to validate empty string path Add tests to validate non-existent string path Add tests to validate nullptr buffer parser --- src/openvic-dataloader/ParseState.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/openvic-dataloader/ParseState.hpp') diff --git a/src/openvic-dataloader/ParseState.hpp b/src/openvic-dataloader/ParseState.hpp index 806829c..259f2a5 100644 --- a/src/openvic-dataloader/ParseState.hpp +++ b/src/openvic-dataloader/ParseState.hpp @@ -30,6 +30,8 @@ namespace ovdl { using file_type = typename ast_type::file_type; using diagnostic_logger_type = BasicDiagnosticLogger; + ParseState() : _ast {}, _logger { this->ast().file() } {} + ParseState(typename ast_type::file_type&& file, detail::Encoding encoding) : _ast { std::move(file) }, _logger { this->ast().file() }, @@ -69,6 +71,8 @@ namespace ovdl { using file_type = FileT; using diagnostic_logger_type = BasicDiagnosticLogger; + FileParseState() : _file {}, _logger { this->file() } {} + FileParseState(file_type&& file, detail::Encoding encoding) : _file { std::move(file) }, _logger { this->file() }, -- cgit v1.2.3-56-ga3b1