summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:56:34 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:56:34 +0000
commitc1e9fa244f6000c61a33f89c9af37ff671cd1230 (patch)
tree6c36695e42f4256a177820b765c2060cfdbebf6f /net
parent25ee670ea74798ad0f95fd3d1a24ce456640feda (diff)
downloadchromium_src-c1e9fa244f6000c61a33f89c9af37ff671cd1230.zip
chromium_src-c1e9fa244f6000c61a33f89c9af37ff671cd1230.tar.gz
chromium_src-c1e9fa244f6000c61a33f89c9af37ff671cd1230.tar.bz2
Make sure filters can handle an empty input buffer
The chaining of filters helped to guarantee that buffers were properly flushed when large expansions took place. That change assumed that a filter could be called with no input (as some filters need to be called repeatedly this way to purge massive internal state). The gzip and bzip filters were returning an error in that scenario. bug=9316 r=huanr Review URL: http://codereview.chromium.org/53074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/bzip2_filter.cc6
-rw-r--r--net/base/gzip_filter.cc6
2 files changed, 8 insertions, 4 deletions
diff --git a/net/base/bzip2_filter.cc b/net/base/bzip2_filter.cc
index ac6aa11..ce825a3 100644
--- a/net/base/bzip2_filter.cc
+++ b/net/base/bzip2_filter.cc
@@ -56,8 +56,10 @@ Filter::FilterStatus BZip2Filter::ReadFilteredData(char* dest_buffer,
return status;
// Make sure we have valid input data
- if (!next_stream_data_ || stream_data_len_ <= 0)
- return status;
+ if (!next_stream_data_ || stream_data_len_ <= 0) {
+ *dest_len = 0;
+ return Filter::FILTER_NEED_MORE_DATA;
+ }
// Fill in bzip2 control block
int ret, output_len = *dest_len;
diff --git a/net/base/gzip_filter.cc b/net/base/gzip_filter.cc
index ff7c1f4..3212e89 100644
--- a/net/base/gzip_filter.cc
+++ b/net/base/gzip_filter.cc
@@ -197,8 +197,10 @@ Filter::FilterStatus GZipFilter::DoInflate(char* dest_buffer, int* dest_len) {
if (!dest_buffer || !dest_len || *dest_len <= 0) // output
return Filter::FILTER_ERROR;
- if (!next_stream_data_ || stream_data_len_ <= 0) // input
- return Filter::FILTER_ERROR;
+ if (!next_stream_data_ || stream_data_len_ <= 0) { // input
+ *dest_len = 0;
+ return Filter::FILTER_NEED_MORE_DATA;
+ }
// Fill in zlib control block
zlib_stream_.get()->next_in = bit_cast<Bytef*>(next_stream_data_);