You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/11/14 05:47:51 UTC
svn commit: r1541816 - in /subversion/branches/1.8.x: ./ STATUS
subversion/tests/libsvn_subr/checksum-test.c
subversion/tests/libsvn_subr/zlib.deflated subversion/tests/svn_test.h
subversion/tests/svn_test_main.c
Author: breser
Date: Thu Nov 14 04:47:51 2013
New Revision: 1541816
URL: http://svn.apache.org/r1541816
Log:
Merge the 1.8.x-r1537193/ branch:
* 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 r1537216, subversion/branches/1.8.x-r1537147/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
subversion/branches/1.8.x/subversion/tests/svn_test.h
subversion/branches/1.8.x/subversion/tests/svn_test_main.c
Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
Merged /subversion/branches/1.8.x-r1537193:r1537217-1541815
Merged /subversion/trunk:r1537147,1537190,1537193,1537221
Merged /subversion/branches/1.8.x-r1537147:r1537201-1537216
Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1541816&r1=1541815&r2=1541816&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Thu Nov 14 04:47:51 2013
@@ -186,19 +186,3 @@ 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
-
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=1541816&r1=1541815&r2=1541816&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:47:51 2013
@@ -23,7 +23,10 @@
#include <apr_pools.h>
+#include <zlib.h>
+
#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
};
Modified: subversion/branches/1.8.x/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/svn_test.h?rev=1541816&r1=1541815&r2=1541816&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/svn_test.h (original)
+++ subversion/branches/1.8.x/subversion/tests/svn_test.h Thu Nov 14 04:47:51 2013
@@ -103,6 +103,8 @@ typedef struct svn_test_opts_t
const char *fs_type;
/* Config file. */
const char *config_file;
+ /* Source dir. */
+ const char *srcdir;
/* Minor version to use for servers and FS backends, or zero to use
the current latest version. */
int server_minor_version;
Modified: subversion/branches/1.8.x/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/svn_test_main.c?rev=1541816&r1=1541815&r2=1541816&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/svn_test_main.c (original)
+++ subversion/branches/1.8.x/subversion/tests/svn_test_main.c Thu Nov 14 04:47:51 2013
@@ -44,6 +44,7 @@
#include "svn_io.h"
#include "svn_path.h"
#include "svn_ctype.h"
+#include "svn_utf.h"
#include "private/svn_cmdline_private.h"
@@ -475,6 +476,10 @@ main(int argc, const char *argv[])
case fstype_opt:
opts.fs_type = apr_pstrdup(pool, opt_arg);
break;
+ case srcdir_opt:
+ SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.srcdir, opt_arg, pool));
+ opts.srcdir = svn_dirent_internal_style(opts.srcdir, pool);
+ break;
case list_opt:
list_mode = TRUE;
break;