mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-16 10:49:36 +00:00
update OpenStreamMalformedContentLength.OutOfRange for stricter parsing
This commit is contained in:
1 parent
982235c0a9
commit
a415362dff
1 file changed
+6
-5
+6
-5
@@ -16093,13 +16093,14 @@ TEST(OpenStreamMalformedContentLength, OutOfRange) {
|
|||||||
auto port = port_future.get();
|
auto port = port_future.get();
|
||||||
ASSERT_GT(port, 0);
|
ASSERT_GT(port, 0);
|
||||||
|
|
||||||
// Before the fix, std::stoull would throw std::out_of_range here and
|
// Historically std::stoull would throw std::out_of_range here and crash
|
||||||
// crash the process. After the fix, strtoull silently clamps to
|
// the process, then strtoull silently clamped to ULLONG_MAX and the
|
||||||
// ULLONG_MAX so the stream opens without crashing. The important thing
|
// stream opened with a bogus framing length. Now the out-of-range value
|
||||||
// is that the process does NOT terminate.
|
// is flagged invalid, so the stream fails to open, matching the
|
||||||
|
// not-a-number case above. The process still must NOT terminate.
|
||||||
Client cli("127.0.0.1", port);
|
Client cli("127.0.0.1", port);
|
||||||
auto handle = cli.open_stream("GET", "/");
|
auto handle = cli.open_stream("GET", "/");
|
||||||
EXPECT_TRUE(handle.is_valid());
|
EXPECT_FALSE(handle.is_valid());
|
||||||
|
|
||||||
server_thread.join();
|
server_thread.join();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user