mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Import of CCTZ from GitHub.
Fixes #2014 PiperOrigin-RevId: 869283027 Change-Id: Ibd7ef8507a8968d1b35fc45a2f023a7d1bde7691
This commit is contained in:
committed by
Copybara-Service
parent
92b4141fef
commit
27a426287c
@@ -978,7 +978,7 @@ bool parse(const std::string& format, const std::string& input,
|
||||
while (std::isspace(*data)) ++data;
|
||||
|
||||
// parse() must consume the entire input string.
|
||||
if (*data != '\0') {
|
||||
if (data != input.data() + input.size()) {
|
||||
if (err != nullptr) *err = "Illegal trailing data in input string";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -967,6 +967,9 @@ TEST(Parse, ErrorCases) {
|
||||
EXPECT_FALSE(parse("%Ez", "+-0:00", tz, &tp));
|
||||
EXPECT_FALSE(parse("%z", "-00-0", tz, &tp));
|
||||
EXPECT_FALSE(parse("%Ez", "-00:-0", tz, &tp));
|
||||
|
||||
// Check that we do not accept strings with embedded NULs.
|
||||
EXPECT_FALSE(parse("%Y", std::string("2026\0payload", 12), tz, &tp));
|
||||
}
|
||||
|
||||
TEST(Parse, PosixConversions) {
|
||||
|
||||
Reference in New Issue
Block a user