Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E79A10A53 for ; Thu, 14 Nov 2013 04:03:31 +0000 (UTC) Received: (qmail 5280 invoked by uid 500); 14 Nov 2013 04:03:28 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 5241 invoked by uid 500); 14 Nov 2013 04:03:27 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 4968 invoked by uid 99); 14 Nov 2013 04:03:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 04:03:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Nov 2013 04:03:07 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B8ECC23888CD; Thu, 14 Nov 2013 04:02:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1541801 - in /subversion/branches/1.8.x: ./ STATUS subversion/tests/libsvn_subr/checksum-test.c subversion/tests/libsvn_subr/zlib.deflated Date: Thu, 14 Nov 2013 04:02:46 -0000 To: commits@subversion.apache.org From: svn-role@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131114040246.B8ECC23888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: svn-role Date: Thu Nov 14 04:02:46 2013 New Revision: 1541801 URL: http://svn.apache.org/r1541801 Log: Merge the r1537193 group from trunk: * r1537193, r1537221, r1540428 Add test to verify if the used ZLib is affected by some block size bugs that affect our usage of serf. Justification: Most Windows binaries were affected by this bug and we should verify that we don't accidentally reintroduce this problem. Notes: This patch needs the source directory for obtaining its test data. The backport branch contains portions of r1537147 and r1537190 to enable this test. Branch: ^/subversion/branches/1.8.x-r1537193/ Votes: +1: stefan2, rhuijben, ivan +1 (without r1540428): brane Added: subversion/branches/1.8.x/subversion/tests/libsvn_subr/zlib.deflated - copied unchanged from r1537193, subversion/trunk/subversion/tests/libsvn_subr/zlib.deflated Modified: subversion/branches/1.8.x/ (props changed) subversion/branches/1.8.x/STATUS subversion/branches/1.8.x/subversion/tests/libsvn_subr/checksum-test.c Propchange: subversion/branches/1.8.x/ ------------------------------------------------------------------------------ Merged /subversion/trunk:r1537193,1537221,1540428 Modified: subversion/branches/1.8.x/STATUS URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1541801&r1=1541800&r2=1541801&view=diff ============================================================================== --- subversion/branches/1.8.x/STATUS (original) +++ subversion/branches/1.8.x/STATUS Thu Nov 14 04:02:46 2013 @@ -187,21 +187,6 @@ Veto-blocked changes: Approved changes: ================= - * r1537193, r1537221, r1540428 - Add test to verify if the used ZLib is affected by some block size bugs that - affect our usage of serf. - Justification: - Most Windows binaries were affected by this bug and we should verify - that we don't accidentally reintroduce this problem. - Notes: - This patch needs the source directory for obtaining its test data. The - backport branch contains portions of r1537147 and r1537190 to enable - this test. - Branch: ^/subversion/branches/1.8.x-r1537193/ - Votes: - +1: stefan2, rhuijben, ivan - +1 (without r1540428): brane - * r1541432 Fix potential crash in mod_authz_svn during startup if path specified by AuthzSVNAccessFile, AuthzSVNReposRelativeAccessFile, or Modified: subversion/branches/1.8.x/subversion/tests/libsvn_subr/checksum-test.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/libsvn_subr/checksum-test.c?rev=1541801&r1=1541800&r2=1541801&view=diff ============================================================================== --- subversion/branches/1.8.x/subversion/tests/libsvn_subr/checksum-test.c (original) +++ subversion/branches/1.8.x/subversion/tests/libsvn_subr/checksum-test.c Thu Nov 14 04:02:46 2013 @@ -23,7 +23,10 @@ #include +#include + #include "svn_error.h" +#include "svn_io.h" #include "private/svn_pseudo_md5.h" #include "../svn_test.h" @@ -155,6 +158,87 @@ zero_match(apr_pool_t *pool) return SVN_NO_ERROR; } +static svn_error_t * +zlib_expansion_test(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + const char *data_path; + svn_stringbuf_t *deflated; + Byte dst_buffer[256 * 1024]; + Byte *src_buffer; + apr_size_t sz; + + data_path = svn_dirent_join(opts->srcdir, "zlib.deflated", pool); + + SVN_ERR(svn_stringbuf_from_file2(&deflated, data_path, pool)); + src_buffer = (Byte*)deflated->data; + + /* Try to decompress the same data with different blocksizes */ + for (sz = 1; sz < 256; sz++) + { + z_stream stream; + memset(&stream, 0, sizeof(stream)); + inflateInit2(&stream, -15 /* DEFLATE_WINDOW_SIZE */); + + stream.avail_in = sz; + stream.next_in = src_buffer; + stream.avail_out = sizeof(dst_buffer); + stream.next_out = dst_buffer; + + do + { + int zr = inflate(&stream, Z_NO_FLUSH); + + if (zr != Z_OK && zr != Z_STREAM_END) + { + return svn_error_createf( + SVN_ERR_TEST_FAILED, NULL, + "Failure decompressing with blocksize %d", (int)sz); + } + stream.avail_in += sz; + } while (stream.next_in + stream.avail_in < src_buffer + deflated->len); + + stream.avail_in = (src_buffer + deflated->len) - stream.next_in; + + { + int zr = inflate(&stream, Z_NO_FLUSH); + + if (zr != Z_STREAM_END) + { + return svn_error_createf( + SVN_ERR_TEST_FAILED, NULL, + "Final flush failed with blocksize %d", (int)sz); + } + + zr = inflateEnd(&stream); + + if (zr != Z_OK) + { + return svn_error_createf( + SVN_ERR_TEST_FAILED, NULL, + "End of stream handling failed with blocksize %d", + (int)sz); + } + } + + { + apr_uint32_t crc = crc32(0, dst_buffer, stream.total_out); + + if (stream.total_out != 242014 || crc != 0x8f03d934) + { + return svn_error_createf( + SVN_ERR_TEST_FAILED, NULL, + "Decompressed data doesn't match expected size or crc with " + "blocksize %d: Found crc32=0x%08x, size=%d.\n" + "Verify your ZLib installation, as this should never happen", + (int)sz, (unsigned)crc, (int)stream.total_out); + } + } + } + + return SVN_NO_ERROR; +} + /* An array of all test functions */ struct svn_test_descriptor_t test_funcs[] = { @@ -167,5 +251,7 @@ struct svn_test_descriptor_t test_funcs[ "pseudo-md5 compatibility"), SVN_TEST_PASS2(zero_match, "zero checksum matching"), + SVN_TEST_OPTS_PASS(zlib_expansion_test, + "zlib expansion test (zlib regression)"), SVN_TEST_NULL };