summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 09:07:47 +0000
committerglider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-01 09:07:47 +0000
commita1398b402a6f03397d40e4ba4e48af4815e529d9 (patch)
tree2fc0054703b4847654c6d1799436dbf800405a83 /net/spdy
parent4231e92747e42878913a0e437a897acfe6d12ebe (diff)
downloadchromium_src-a1398b402a6f03397d40e4ba4e48af4815e529d9.zip
chromium_src-a1398b402a6f03397d40e4ba4e48af4815e529d9.tar.gz
chromium_src-a1398b402a6f03397d40e4ba4e48af4815e529d9.tar.bz2
Check that uncompressed data passed to zlib is defined, and mark compression
result as defined. This way, we suppress benign reports from zlib (see http://www.zlib.net/zlib_faq.html#faq36), without losing coverage of spdy code. This patch was prepared by eugenis@chromium.org (doesn't have a committer access yet) and reviewed at http://codereview.chromium.org/6310016/ BUG=70098 TEST=run automated_ui_tests with random action lists under Valgrind for a few hours at least. TBR=wtc Review URL: http://codereview.chromium.org/6287040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_framer.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 9a3203b..fd3db10 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -10,6 +10,7 @@
#include "base/metrics/stats_counters.h"
#include "base/scoped_ptr.h"
+#include "base/third_party/valgrind/memcheck.h"
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_bitmasks.h"
@@ -955,6 +956,10 @@ SpdyFrame* SpdyFramer::CompressFrameWithZStream(const SpdyFrame& frame,
data_frame->set_flags(data_frame->flags() | DATA_FLAG_COMPRESSED);
}
+ // Make sure that all the data we pass to zlib is defined.
+ // This way, all Valgrind reports on the compressed data are zlib's fault.
+ VALGRIND_CHECK_MEM_IS_DEFINED(compressor->next_in, compressor->avail_in);
+
int rv = deflate(compressor, Z_SYNC_FLUSH);
if (rv != Z_OK) { // How can we know that it compressed everything?
// This shouldn't happen, right?
@@ -963,6 +968,9 @@ SpdyFrame* SpdyFramer::CompressFrameWithZStream(const SpdyFrame& frame,
}
int compressed_size = compressed_max_size - compressor->avail_out;
+ // We trust zlib. Also, we can't do anything about it.
+ // See http://www.zlib.net/zlib_faq.html#faq36
+ VALGRIND_MAKE_MEM_DEFINED(new_frame->data() + header_length, compressed_size);
new_frame->set_length(header_length + compressed_size - SpdyFrame::size());
pre_compress_bytes.Add(payload_length);