| Index: net/dns/dns_response.cc
|
| diff --git a/net/dns/dns_response.cc b/net/dns/dns_response.cc
|
| index 4a3371c2adb1b42b267f7a1c161ca58f191f94f4..38f93c10659d07879467ff9dec0515667e0a63dc 100644
|
| --- a/net/dns/dns_response.cc
|
| +++ b/net/dns/dns_response.cc
|
| @@ -162,6 +162,7 @@ DnsResponse::~DnsResponse() {
|
| }
|
|
|
| bool DnsResponse::InitParse(int nbytes, const DnsQuery& query) {
|
| + DCHECK_GE(nbytes, 0);
|
| // Response includes query, it should be at least that size.
|
| if (nbytes < query.io_buffer()->size() || nbytes >= io_buffer_->size())
|
| return false;
|
| @@ -190,10 +191,13 @@ bool DnsResponse::InitParse(int nbytes, const DnsQuery& query) {
|
| }
|
|
|
| bool DnsResponse::InitParseWithoutQuery(int nbytes) {
|
| - if (nbytes >= io_buffer_->size())
|
| - return false;
|
| + DCHECK_GE(nbytes, 0);
|
|
|
| size_t hdr_size = sizeof(dns_protocol::Header);
|
| +
|
| + if (nbytes < static_cast<int>(hdr_size) || nbytes >= io_buffer_->size())
|
| + return false;
|
| +
|
| parser_ = DnsRecordParser(
|
| io_buffer_->data(), nbytes, hdr_size);
|
|
|
|
|