Compare commits

..

No commits in common. "rawhide" and "f41" have entirely different histories.

6 changed files with 170 additions and 27 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/zsync-0.6.2.tar.bz2
/zsync-0.6.3.tar.bz2

View file

@ -0,0 +1,89 @@
Description: Fix build with GCC-14
Author: Marcos Talau <talau@debian.org>
Bug-Debian: https://bugs.debian.org/1075710
Forwarded: https://github.com/cph6/zsync/issues/20
Last-Update: 2024-08-16
Index: zsync-0.6.2/client.c
===================================================================
--- zsync-0.6.2.orig/client.c
+++ zsync-0.6.2/client.c
@@ -392,7 +392,7 @@ int fetch_remaining_blocks_http(struct z
*/
int fetch_remaining_blocks(struct zsync_state *zs) {
int n, utype;
- const char *const *url = zsync_get_urls(zs, &n, &utype);
+ char **url = zsync_get_urls(zs, &n, &utype);
int *status; /* keep status for each URL - 0 means no error */
int ok_urls = n;
@@ -452,7 +452,7 @@ extern long global_offset;
int main(int argc, char **argv) {
struct zsync_state *zs;
char *temp_file = NULL;
- char **seedfiles = NULL;
+ void **seedfiles = NULL;
int nseedfiles = 0;
char *filename = NULL;
long long local_used;
Index: zsync-0.6.2/libzsync/zmap.c
===================================================================
--- zsync-0.6.2.orig/libzsync/zmap.c
+++ zsync-0.6.2/libzsync/zmap.c
@@ -333,7 +333,7 @@ int zmap_search(const struct zmap* zm, l
* and in the order that it returned them, this condition is satisfied.
*/
void configure_zstream_for_zdata(const struct zmap *zm, z_stream * zs,
- long zoffset, long long *poutoffset) {
+ long zoffset, off_t *poutoffset) {
/* Find the zmap entry corresponding to this offset */
int i = zmap_search(zm, zoffset);
Index: zsync-0.6.2/libzsync/zmap.h
===================================================================
--- zsync-0.6.2.orig/libzsync/zmap.h
+++ zsync-0.6.2/libzsync/zmap.h
@@ -29,7 +29,7 @@ struct zmap* zmap_make(const struct gzbl
void zmap_free(struct zmap*);
off_t* zmap_to_compressed_ranges(const struct zmap* zm, off_t* byterange, int nrange, int* num);
-void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, long long* poutoffset);
+void configure_zstream_for_zdata(const struct zmap* zm, struct z_stream_s* zs, long zoffset, off_t* poutoffset);
/* gzip flag byte */
#define GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
Index: zsync-0.6.2/libzsync/zsync.c
===================================================================
--- zsync-0.6.2.orig/libzsync/zsync.c
+++ zsync-0.6.2/libzsync/zsync.c
@@ -436,7 +436,7 @@ void zsync_progress(const struct zsync_s
* Note that these URLs could be for encoded versions of the target; a 'type'
* is returned in *type which tells libzsync in later calls what version of the
* target is being retrieved. */
-const char *const *zsync_get_urls(struct zsync_state *zs, int *n, int *t) {
+char **zsync_get_urls(struct zsync_state *zs, int *n, int *t) {
if (zs->zmap && zs->nzurl) {
*n = zs->nzurl;
*t = 1;
@@ -768,7 +768,7 @@ char *zsync_end(struct zsync_state *zs)
*/
void zsync_configure_zstream_for_zdata(const struct zsync_state *zs,
struct z_stream_s *zstrm,
- long zoffset, long long *poutoffset) {
+ long zoffset, off_t *poutoffset) {
configure_zstream_for_zdata(zs->zmap, zstrm, zoffset, poutoffset);
{ /* Load in prev 32k sliding window for backreferences */
long long pos = *poutoffset;
Index: zsync-0.6.2/libzsync/zsync.h
===================================================================
--- zsync-0.6.2.orig/libzsync/zsync.h
+++ zsync-0.6.2/libzsync/zsync.h
@@ -58,7 +58,7 @@ int zsync_submit_source_file(struct zsyn
* (the URL pointers are still referenced by the library, and are valid only until zsync_end).
*/
-const char * const * zsync_get_urls(struct zsync_state* zs, int* n, int* t);
+char ** zsync_get_urls(struct zsync_state* zs, int* n, int* t);
/* zsync_needed_byte_ranges - get the byte ranges needed from a URL.
* Returns the number of ranges in *num, and a malloc'd array (to be freed

71
remove-ub-in-zlib.patch Normal file
View file

@ -0,0 +1,71 @@
From 6a043145ca6e9c55184013841a67b2fef87e44c0 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Wed, 21 Sep 2016 23:35:50 -0700
Subject: [PATCH] Remove offset pointer optimization in inftrees.c.
inftrees.c was subtracting an offset from a pointer to an array,
in order to provide a pointer that allowed indexing starting at
the offset. This is not compliant with the C standard, for which
the behavior of a pointer decremented before its allocated memory
is undefined. Per the recommendation of a security audit of the
zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, this tiny optimization was removed, in order
to avoid the possibility of undefined behavior.
---
inftrees.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/inftrees.c b/inftrees.c
index 22fcd6666..0d2670d57 100644
--- a/zlib/inftrees.c
+++ b/zlib/inftrees.c
@@ -54,7 +54,7 @@ unsigned short FAR *work;
code FAR *next; /* next available space in table */
const unsigned short FAR *base; /* base value table to use */
const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
+ unsigned match; /* use base and extra for symbol >= match */
unsigned short count[MAXBITS+1]; /* number of codes of each length */
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
@@ -181,19 +181,17 @@ unsigned short FAR *work;
switch (type) {
case CODES:
base = extra = work; /* dummy value--not used */
- end = 19;
+ match = 20;
break;
case LENS:
base = lbase;
- base -= 257;
extra = lext;
- extra -= 257;
- end = 256;
+ match = 257;
break;
default: /* DISTS */
base = dbase;
extra = dext;
- end = -1;
+ match = 0;
}
/* initialize state for loop */
@@ -216,13 +214,13 @@ unsigned short FAR *work;
for (;;) {
/* create table entry */
this.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
+ if (work[sym] + 1 < match) {
this.op = (unsigned char)0;
this.val = work[sym];
}
- else if ((int)(work[sym]) > end) {
- this.op = (unsigned char)(extra[work[sym]]);
- this.val = base[work[sym]];
+ else if (work[sym] >= match) {
+ this.op = (unsigned char)(extra[work[sym] - match]);
+ this.val = base[work[sym] - match];
}
else {
this.op = (unsigned char)(32 + 64); /* end of block */

View file

@ -1 +1 @@
SHA512 (zsync-0.6.3.tar.bz2) = b7b9f16c9dc9d3d7753eb43e57d8c4bc8adea37ed3b6372829b466d3b010dd2c287a1de2ec02a5f1a4d96ee52fdcfec6d6021776368fe4a3af862c785de20089
SHA512 (zsync-0.6.2.tar.bz2) = 56437594831f2320c532759805b5c51116c53c8848f14b54cfd9b76676d1d061abe7fc914264f496ed1c7922fbbd5b884166c855a2fb9eb1285f216e478c5f0d

View file

@ -1,21 +0,0 @@
From a5cb28f923dd3cfdeb65e2930dd1faa727c2abf8 Mon Sep 17 00:00:00 2001
From: Colin Phipps <cph@moria.org.uk>
Date: Thu, 29 May 2025 08:33:11 +0100
Subject: [PATCH] Update check-zsyncmake for changes in 208ef06.
---
c/check-zsyncmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/c/check-zsyncmake b/c/check-zsyncmake
index 3006230..08791e1 100755
--- a/check-zsyncmake
+++ b/check-zsyncmake
@@ -4,6 +4,6 @@ ${top_builddir-.}/zsyncmake -u foo -f foo ${srcdir-.}/INSTALL
# Note TAB required for Solaris cksum
x=`perl -pe 's/^(zsync:).*$/$1 XXX/; s/^(MTime:)(.*)$/my ($x, $y) = ($1, $2); $y =~ s![a-zA-Z0-9]!_!g; "$x$y"/e;' foo.zsync | tee foo.tr.zsync | cksum | sed -e 's/[ ][0-9].*//'`
-[ $x = 4103379992 ]
+[ $x = 3456223344 ]
rm foo.zsync

View file

@ -1,15 +1,19 @@
Name: zsync
Summary: a file transfer program using the same algorithm as rsync over HTTP
URL: https://zsync.moria.org.uk/
URL: http://zsync.moria.org.uk/
License: Artistic-2.0 and Zlib and NTP and LicenseRef-Fedora-Public-Domain
# Zlib: zlib/*
# NTP: base64.c
# PD: librcksum/*
Version: 0.6.3
Version: 0.6.2
Release: %autorelease
Source0: https://zsync.moria.org.uk/download/%{name}-%{version}.tar.bz2
Patch0: zsync-0.6.3-fix-tests.patch
Source0: http://zsync.moria.org.uk/download/%{name}-%{version}.tar.bz2
# https://sources.debian.org/data/main/z/zsync/0.6.2-7/debian/patches/fix-build-with-gcc-14.patch
Patch1: fix-build-with-gcc-14.patch
# https://github.com/madler/zlib/commit/6a043145ca6e9c55184013841a67b2fef87e44c0 (modif'd to apply)
Patch2: remove-ub-in-zlib.patch
BuildRequires: gcc
BuildRequires: make
@ -36,6 +40,7 @@ large scale file distribution.
sed -i '/^doc_DATA/s/COPYING//' Makefile.am # avoid duplicating license file
%build
autoreconf -if
%configure
%make_build CFLAGS+="-Wno-old-style-definition -D_DEFAULT_SOURCE"
# bundled zlib uses old-style function definition, ignore.