Skip to content

Commit

Permalink
[Bugfix] Fix past-the-end iterator dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirraide committed Oct 29, 2023
1 parent 508e188 commit 519559e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ if (FCHK_FORCE_RELEASE)
endif()
else()
if (NOT MSVC)
target_compile_definitions(_fchk_options INTERFACE _GLIBCXX_DEBUG)
target_compile_options(_fchk_options INTERFACE
$<$<CONFIG:DEBUG>:-O0 -g3 -ggdb3>
$<$<CONFIG:RELEASE>:-O3 -march=native>
Expand Down
7 changes: 4 additions & 3 deletions src/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <pcre2.h>

#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
# define NOMINMAX
# include <Windows.h>
#endif

auto utils::Drain(FILE* f) -> std::string {
Expand Down Expand Up @@ -139,7 +139,7 @@ auto GetProcessOutput(std::string_view cmd) -> std::string {
#endif
}

}
} // namespace

/// ===========================================================================
/// Location
Expand Down Expand Up @@ -752,6 +752,7 @@ class Matcher {
if (
in == input_lines.end() or
chk == ctx->checks.end() or
std::next(chk) == ctx->checks.end() or
std::next(chk)->dir == Directive::CheckNot or
std::next(chk)->dir == Directive::RegexCheckNot or
std::next(chk)->dir == Directive::InternalCheckNotEmpty
Expand Down

0 comments on commit 519559e

Please sign in to comment.