Hi,

On 2026/01/16 8:45, [email protected] wrote:
> Author: brane
> Date: Thu Jan 15 23:45:34 2026
> New Revision: 1931334
> 
> Log:
> Remove another unchecked narrowing cast, this time in the implementation
> of the adler32 checksum. Make sure we consume all the data, no matter
> how improbably large it may be.
> 
> 
> * build/ac-macros/zlib.m4
>   (SVN_LIB_Z): Check if we're using a version of zlib that provides the
>    function adler32_z(), which uses size_t instead of unsigned int for
>    the length of the input data.
> 
> * build.conf
>   (adler32-test): Define a new unit test program.
> 
> * subversion/libsvn_subr/adler32.c: Include svn_private_config.h.
>   (svn__adler32_impl, svn__adler32_fn, svn__adler32_size_t,
>    SVN__ADLER32_SIZE_MAX): New type and macros to use adler32_z() if
>    available and adler32() if not, without too much clutter elsewhere.
>   (SVN__ADLER_MOD_BASE): Renamed from ADLER_MOD_BASE and made unsigned.
>   (svn__adler32): Consume huge input data sets in SVN__ADLER32_SIZE_MAX
>    -sized chunks. Shortcut the result if someone fed us zero-length data.
> 
> * subversion/tests/libsvn_subr/adler32-test.c: New file with tests
>    that compare our adler32 implementation with the one in zlib.
> 
> Added:
>    subversion/trunk/subversion/tests/libsvn_subr/adler32-test.c   (contents, 
> props changed)
> Modified:
>    subversion/trunk/build.conf
>    subversion/trunk/build/ac-macros/zlib.m4
>    subversion/trunk/subversion/libsvn_subr/adler32.c
> 
> Modified: subversion/trunk/build.conf
> ==============================================================================
> --- subversion/trunk/build.conf       Thu Jan 15 22:21:35 2026        
> (r1931333)
> +++ subversion/trunk/build.conf       Thu Jan 15 23:45:34 2026        
> (r1931334)
> @@ -932,6 +932,14 @@ libs = libsvn_test libsvn_wc libsvn_repo
>  # 
> ----------------------------------------------------------------------------
>  # Tests for libsvn_subr
>  
> +[adler32-test]
> +description = Test our implementation of the adler32 checksum.
> +type = exe
> +path = subversion/tests/libsvn_subr
> +sources = adler32-test.c
> +install = test
> +libs = libsvn_test libsvn_subr apr
> +
>  [auth-test]
>  description = Test platform-specific auth provider access
>  type = exe
> 

I encountered another issue, adler32-test.exe is not built with Visual
Studio on Windows, due to missing adler32-test in libs of
[__ALL_TESTS__] section.

[[[
  Testing Release configuration on remote repository http://localhost:28630.
  [001/124] adler32-test.exe
  Not an executable file: adler32-test.exe
]]]

Proposed fix:

[[[
diff --git a/build.conf b/build.conf
index 22b48ba17..3b97f967c 100644
--- a/build.conf
+++ b/build.conf
@@ -1617,6 +1617,7 @@ libs = __ALL__
        auth-test
        parse-diff-test x509-test xml-test afl-x509 afl-svndiff compress-test
        svndiff-stream-test
+       adler32-test

 [__MORE__]
 type = project
]]]

-- 
Jun Omae <[email protected]> (大前 潤)

Reply via email to