diff options
author | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-05 10:15:04 +0000 |
---|---|---|
committer | glider@chromium.org <glider@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-05 10:15:04 +0000 |
commit | 39d42071889742722678bcca073310723ab53e74 (patch) | |
tree | d25f262eef68daa841b7becbac9adcdc5b4455aa /net/spdy | |
parent | 1a5692f1b00d21d852f828e6806b49554cc07e2c (diff) | |
download | chromium_src-39d42071889742722678bcca073310723ab53e74.zip chromium_src-39d42071889742722678bcca073310723ab53e74.tar.gz chromium_src-39d42071889742722678bcca073310723ab53e74.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 originally prepared by eugenis@chromium.org (doesn't have a committer
access yet) and reviewed at http://codereview.chromium.org/6591101/
TBR=wtc
Review URL: http://codereview.chromium.org/6286146
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_framer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index 9a3203b..b6f0901 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,11 @@ 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. + (void)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 +969,12 @@ 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 + (void)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); |