28 Commits

Author SHA1 Message Date
Edward Thomson
b72dfb0e73 zlib: update bundled zlib to v1.3.1 2024-10-07 21:38:30 +01:00
Edward Thomson
d83fccc97a zlib: upgrade bundled zlib to v1.3 2023-12-20 12:05:48 +00:00
Mark Adler
af76267ad7 zlib: Silence some warnings from Visual Studio C. 2022-07-12 14:27:46 -04:00
Andrzej Hunt
39ba0ee604 zlib: slide_hash: add MSAN annotation to suppress known read from uninitialised memory
slide_hash knowingly reads (possibly) uninitialised memory, see comment
lower down about prev[n] potentially being garbage. In this case, the
result is never used - so we don't care about MSAN complaining about
this read.

By adding the no_sanitize("memory") attribute, clients of zlib won't
see this (unnecessary) error when building and running with
MemorySanitizer. An alternative approach is for clients to build zlib
with -fsanitize-ignorelist=... where the ignorelist contains something
like 'fun:slide_hash'. But that's more work and needs to be redone
for any and all CI systems running a given project with MSAN. Adding
this annotation to zlib's sources is overall more convenient - but
also won't affect non-MSAN builds.

This specific issue was found while running git's test suite, but has
also been reported by other clients, see e.g. #518.
2022-07-12 14:27:46 -04:00
Edward Thomson
6febb7d767 zlib: declare prototypes for new functions
The `crc32_combine_gen64` missed a prototype in our define path.
Add one.
2022-07-12 14:27:46 -04:00
Edward Thomson
2db6cdcd66 zlib: updated bundled zlib to v1.2.12 2022-07-12 14:27:46 -04:00
lhchavez
3a197ea7ea Make the tests pass cleanly with MemorySanitizer
This change:

* Initializes a few variables that were being read before being
  initialized.
* Includes https://github.com/madler/zlib/pull/393. As such,
  it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
2020-06-30 06:25:10 -07:00
Patrick Steinhardt
b85eefb460 cmake: Sort source files for reproducible builds
We currently use `FILE(GLOB ...)` in most places to find source and
header files. This is problematic in that the order of files returned
depends on the operating system's directory iteration order and may thus
not be deterministic. As a result, we link object files in unspecified
order, which may cause the linker to emit different code across runs.

Fix this issue by sorting all code used as input to the libgit2 library
to improve the reliability of reproducible builds.
2020-05-15 19:57:09 +02:00
Edward Thomson
9f3441ccf5 zlib: remove unused functions 2019-06-24 17:27:23 +01:00
lhchavez
b5e8272fdc Attempt at fixing the MingW64 compilation
It seems like MingW64's size_t is defined differently than in Linux.
2019-01-06 08:29:56 -08:00
Patrick Steinhardt
2e0f926e1c docs: clarify and include licenses of dependencies
While our contribution guide tries to make clear the licenses that apply
to libgit2, it does not make clear that different licenses apply to our
bundled dependencies. Make this clear by listing each dependency
together with the licenses that they are governed by. Furthermore,
bundle the complete license texts next to the code they apply to.
2018-08-30 12:16:59 +02:00
Patrick Steinhardt
4c5330cb83 deps: upgrade embedded zlib to version 1.2.11
The current version of zlib bundled with libgit2 is version 1.2.8. This
version has several CVEs assigned:

- CVE-2016-9843
- CVE-2016-9841
- CVE-2016-9842
- CVE-2016-9840

Upgrade the bundled version to the current release 1.2.11, which has
these vulnerabilities fixes.
2018-03-07 10:33:41 +00:00
Patrick Steinhardt
8c19969a88 cmake: fix static linking for bundled deps
Our bundled deps are being built as simple static libraries which are
then linked into the libgit2 library via `TARGET_LINK_LIBRARIES`. While
this works for a dynamically built libgit2 library, using this function
to link two static libraries does not have the expected outcome of
merging those static libraries into one big library. This leads to
symbols of our bundled deps being undefined in the resulting libgit2
archive.

As we have bumped our minimum CMake version to 2.8.11, we can now easily
make use of object libraries for our bundled dependencies. So build
instructions are still self-contained inside of the dependency
directories and the resulting object libraries can just be added to the
LIBGIT2_OBJECTS list, which will cause them to be linked into the final
resulting static library. This fixes the issue of undefined symbols.
2017-09-20 15:26:26 +02:00
Patrick Steinhardt
1f43a43dce cmake: move zlib build instructions into subdirectory
Extract code required to build the zlib library into its own
CMakeLists.txt, which is included as required.
2017-08-16 07:12:38 +02:00
Patrick Steinhardt
9b0482e4d4 zlib: include "git2/types.h" instead of "common.h"
The zlib dependency includes "common.h" inside of the "zconf.h" header
to make available some type declarations like e.g. git_off_t. Including
the "common.h" header does pull in quite a lot of other headers though,
which are not required at all. Instead, we can just include our public
"git2/types.h" header, which is much more limited in its scope but still
provides everything required for "zconf.h".

This fix eases the transition later on to use a separate "features.h"
header instead of defines. As we have to generate the "features.h"
header, we put it in the build directory and add an include directory.
As we are splitting out building of dependencies into subdirectories,
this would mean that the zlib dependency needs to be aware of the parent
project's build directory, which is unfortunate. By including
"git2/types.h", we avoid this problem.
2017-07-03 08:51:47 +00:00
Carlos Martín Nieto
b42ff7c016 zlib: disable warning 4142 on MSVC
This is about benign redefinition of types. We're not interested in it.
2014-06-11 18:33:55 +02:00
Carlos Martín Nieto
4f8ac2163b zlib: get rid of compress.c and uncompr.c 2014-06-11 18:33:55 +02:00
Carlos Martín Nieto
2bc76050e0 zlib: get rid of gz* 2014-06-11 18:33:55 +02:00
Carlos Martín Nieto
a9185589f9 zlib: add a few missing defines 2014-06-11 18:03:37 +02:00
Carlos Martín Nieto
7cead31edd Merge branch 'cmn/zlib-128' into cmn/zlib-update
Conflicts:
	deps/zlib/crc32.c
	deps/zlib/crc32.h
	deps/zlib/zconf.h
2014-06-11 16:36:08 +02:00
Carlos Martín Nieto
4ca2d7e444 Update zlib to 1.2.8 2014-06-11 16:10:00 +02:00
Vicent Marti
f6867e639a Fix compilation in Windows 2011-08-08 16:56:28 -07:00
Vicent Marti
ec62685345 zlib: Declare preprocessor directives at build time 2011-07-01 17:34:27 +02:00
Vicent Marti
8a0620030c zlib: No visualization attributes.
The visibility attribute is a headache on many platforms like Solaris,
and not even supported on Windows.
2011-06-30 22:28:19 +02:00
Vicent Marti
9f81a37aa4 Define NO_GZIP in zconf.h instead of at compile time 2011-03-16 23:02:31 +02:00
Vicent Marti
434bedcda0 Fix compilation warnings in ZLib (MSVC)
Yes, we are changing the Zlib code. This is dangerous and uncool.
Fortunately, these are just some implicit casts.
2011-03-15 19:46:38 +02:00
Vicent Marti
5f8078d4dc Use a more sane zconf.f when building Zlib 2011-03-15 04:22:47 +02:00
Vicent Marti
ab6a3d3de5 Add ZLib as a built-in dependency
I don't know if this is good or bad. This lets libgit2 compile cleanly
on any platforms without any external dependencies, but adds a little
bit of bloat...

Let's test this out and see what happens.
2011-03-15 03:29:20 +02:00