summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/jsonParse.impl.cpp5
-rw-r--r--lib/jsonParse.ll8
-rw-r--r--lib/persistence.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/lib/jsonParse.impl.cpp b/lib/jsonParse.impl.cpp
index 3ed8e62..4d13eae 100644
--- a/lib/jsonParse.impl.cpp
+++ b/lib/jsonParse.impl.cpp
@@ -12,7 +12,7 @@ json::jsonParser::LexerError(const char * msg)
void
json::jsonParser::appendEscape(const char * cphs, std::string & str)
{
- appendEscape(std::strtoul(cphs, nullptr, 16), str);
+ appendEscape(std::strtoul(cphs + 1, nullptr, 16), str);
}
void
@@ -39,4 +39,7 @@ json::jsonParser::appendEscape(unsigned long cp, std::string & str)
str += char(((cp >> 6) & 63) + 128);
str += char((cp & 63) + 128);
}
+ else {
+ throw std::range_error("Invalid UTF-8 sequence");
+ }
}
diff --git a/lib/jsonParse.ll b/lib/jsonParse.ll
index 52ad89f..c9c708c 100644
--- a/lib/jsonParse.ll
+++ b/lib/jsonParse.ll
@@ -17,6 +17,7 @@ class jsonBaseFlexLexer;
#ifdef __clang__
#pragma clang diagnostic ignored "-Wnull-conversion"
#endif
+[[maybe_unused]]static constexpr auto x=getpid;
%}
beginobj "{"
@@ -152,7 +153,6 @@ text [^\\\"]*
<*>[ \t\r\n\f] {
}
-%%
-
-// Make iwyu think unistd.h is required
-[[maybe_unused]]static auto x=getpid;
+<*>. {
+ LexerError("Unexpected input");
+}
diff --git a/lib/persistence.cpp b/lib/persistence.cpp
index 5744cd7..15391ad 100644
--- a/lib/persistence.cpp
+++ b/lib/persistence.cpp
@@ -62,6 +62,7 @@ namespace Persistence {
throw std::runtime_error("Unexpected object");
}
+ /// LCOV_EXCL_START Don't think we can trigger these from something lexer will parse
void
Selection::beforeValue(Stack &)
{
@@ -78,4 +79,5 @@ namespace Persistence {
Selection::endObject(Stack &)
{
}
+ /// LCOV_EXCL_STOP
}