summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 01:19:38 +0000
committerpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 01:19:38 +0000
commit7f5a75a5ee81ddb09effe754e2c12e84d768b85d (patch)
treedb77947a3aed1ed3409a1bf8596d62cf5642dcc0 /net
parent25d28d65ffcbac3f4b1944e38c014be6f4d30bf8 (diff)
downloadchromium_src-7f5a75a5ee81ddb09effe754e2c12e84d768b85d.zip
chromium_src-7f5a75a5ee81ddb09effe754e2c12e84d768b85d.tar.gz
chromium_src-7f5a75a5ee81ddb09effe754e2c12e84d768b85d.tar.bz2
Add a call to MemoryDebug::MarkAsInitialized to the new network code to avoid
false UMR reports from Purify due to asynchronous filling of memory from the socket. BUG=5297 TEST=run test_shell.exe http://localhost:8080/multipart/invalid-image-data-standalone.html in Purify, see no UMRs in net code. Or watch the layout-test Purify buildbot running http/tests/invalid-image-data{-standalone}.html Review URL: http://codereview.chromium.org/13331 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/tcp_client_socket_win.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/base/tcp_client_socket_win.cc b/net/base/tcp_client_socket_win.cc
index 11a6de3..1111d71 100644
--- a/net/base/tcp_client_socket_win.cc
+++ b/net/base/tcp_client_socket_win.cc
@@ -4,6 +4,7 @@
#include "net/base/tcp_client_socket.h"
+#include "base/memory_debug.h"
#include "base/string_util.h"
#include "base/trace_event.h"
#include "net/base/net_errors.h"
@@ -175,6 +176,14 @@ int TCPClientSocket::Read(char* buf,
BOOL ok = WSAResetEvent(overlapped_.hEvent);
CHECK(ok);
TRACE_EVENT_END("socket.read", this, StringPrintf("%d bytes", num));
+
+ // Because of how WSARecv fills memory when used asynchronously, Purify
+ // isn't able to detect that it's been initialized, so it scans for 0xcd
+ // in the buffer and reports UMRs (uninitialized memory reads) for those
+ // individual bytes. We override that in PURIFY builds to avoid the false
+ // error reports.
+ // See bug 5297.
+ base::MemoryDebug::MarkAsInitialized(buffer_.buf, num);
return static_cast<int>(num);
}
int err = WSAGetLastError();