Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: net/dns/dns_response_unittest.cc

Issue 15326002: Fix bug in InitParseWithoutQuestion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_response.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_response_unittest.cc
diff --git a/net/dns/dns_response_unittest.cc b/net/dns/dns_response_unittest.cc
index 43a1b3a00e329a3d1bf5c76df33eb3e4a731b320..792213781ffb6123c383bab11df920159d04e765 100644
--- a/net/dns/dns_response_unittest.cc
+++ b/net/dns/dns_response_unittest.cc
@@ -378,6 +378,20 @@ TEST(DnsResponseTest, InitParseWithoutQueryTwoQuestions) {
EXPECT_FALSE(parser.ReadRecord(&record));
}
+TEST(DnsResponseTest, InitParseWithoutQueryPacketTooShort) {
+ const uint8 response_data[] = {
+ // Header
+ 0xca, 0xfe, // ID
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No question
+ };
+
+ DnsResponse resp;
+ memcpy(resp.io_buffer()->data(), response_data, sizeof(response_data));
+
+ EXPECT_FALSE(resp.InitParseWithoutQuery(sizeof(response_data)));
+}
+
void VerifyAddressList(const std::vector<const char*>& ip_addresses,
const AddressList& addrlist) {
ASSERT_EQ(ip_addresses.size(), addrlist.size());
« no previous file with comments | « net/dns/dns_response.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698