|
Boost-Commit : |
From: technews_at_[hidden]
Date: 2008-06-01 11:38:28
Author: turkanis
Date: 2008-06-01 11:38:27 EDT (Sun, 01 Jun 2008)
New Revision: 46013
URL: http://svn.boost.org/trac/boost/changeset/46013
Log:
added CRC check; replaced assignment with ==; zero crc and isize in footer::reset()
Text files modified:
trunk/boost/iostreams/filter/gzip.hpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Modified: trunk/boost/iostreams/filter/gzip.hpp
==============================================================================
--- trunk/boost/iostreams/filter/gzip.hpp (original)
+++ trunk/boost/iostreams/filter/gzip.hpp 2008-06-01 11:38:27 EDT (Sun, 01 Jun 2008)
@@ -448,6 +448,8 @@
}
footer_.process(c);
if (footer_.done()) {
+ if (footer_.crc() != this->crc())
+ throw gzip_error(gzip::bad_crc);
int c = boost::iostreams::get(peek);
if (traits_type::is_eof(c)) {
state_ = s_done;
@@ -787,7 +789,7 @@
} else {
++offset_;
}
- } else if (state_ = s_isize) {
+ } else if (state_ == s_isize) {
isize_ += value << (offset_ * 8);
if (offset_ == 3) {
state_ = s_done;
@@ -802,8 +804,8 @@
void gzip_footer::reset()
{
+ crc_ = isize_ = offset_ = 0;
state_ = s_crc;
- offset_ = 0;
}
} // End namespace boost::iostreams::detail.
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk