Commit b52c2cfd authored by Alex Gough's avatar Alex Gough Committed by Commit Bot

Make overflow in refcount impossible.

It is unlikely that this can be controlled from the mdns API without
exhausting other system resources however it pays to be careful.

Bug: 1101547
Change-Id: I268d9bdbcd8360e622fa2a836a6dbaa4e6ea27c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285931
Auto-Submit: Alex Gough <ajgo@chromium.org>
Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Commit-Queue: mark a. foltz <mfoltz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786390}
parent 1ece76b0
......@@ -4,8 +4,10 @@
#include "chrome/browser/media/router/discovery/mdns/dns_sd_registry.h"
#include <limits>
#include <utility>
#include "base/check.h"
#include "base/stl_util.h"
#include "chrome/browser/local_discovery/service_discovery_shared_client.h"
#include "chrome/browser/media/router/discovery/mdns/dns_sd_device_lister.h"
......@@ -38,6 +40,7 @@ DnsSdRegistry::ServiceTypeData::~ServiceTypeData() {}
void DnsSdRegistry::ServiceTypeData::ListenerAdded() {
ref_count++;
CHECK(ref_count != std::numeric_limits<decltype(ref_count)>::max());
}
bool DnsSdRegistry::ServiceTypeData::ListenerRemoved() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment