Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dd_rescue for openSUSE:Factory checked in at 2023-03-01 16:13:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dd_rescue (Old) and /work/SRC/openSUSE:Factory/.dd_rescue.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dd_rescue" Wed Mar 1 16:13:40 2023 rev:57 rq:1068136 version:1.99.13 Changes: -------- --- /work/SRC/openSUSE:Factory/dd_rescue/dd_rescue.changes 2023-02-11 22:20:14.188091721 +0100 +++ /work/SRC/openSUSE:Factory/.dd_rescue.new.31432/dd_rescue.changes 2023-03-01 16:13:44.986506006 +0100 @@ -1,0 +2,20 @@ +Tue Feb 28 09:44:46 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- temporarily remove not-really-detached-signature + +------------------------------------------------------------------- +Fri Feb 24 09:37:35 CET 2023 - k...@garloff.de + +- Update to 1.99.13: + * Drop fuzz-lzo-* patches, as they have been merged upstream. + * Allow overriding strip binary (not used in this build). + * Make -fanalyzer more happy: abort() and assert()ions to ensure + we always react to failed memory allocations. + * ddr_hash: Support reading/writing checksums from stdin/out "-". + * Fix aliasing issue with XORN function (in aes.h), spotted by + gcc-13: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108695 + Drop workaround from Martin Liška again. + * Higher optimization level for aes.c driver is beneficial for + key setup speed. + +------------------------------------------------------------------- Old: ---- dd_rescue-1.99.12.tar.bz2 dd_rescue-1.99.12.tar.bz2.asc New: ---- dd_rescue-1.99.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dd_rescue.spec ++++++ --- /var/tmp/diff_new_pack.xbLQQF/_old 2023-03-01 16:13:45.538508860 +0100 +++ /var/tmp/diff_new_pack.xbLQQF/_new 2023-03-01 16:13:45.542508880 +0100 @@ -21,14 +21,14 @@ %define _lto_cflags %{nil} %endif Name: dd_rescue -Version: 1.99.12 +Version: 1.99.13 Release: 0 Summary: Data copying in the presence of I/O Errors License: GPL-2.0-only OR GPL-3.0-only Group: System/Base URL: http://www.garloff.de/kurt/linux/ddrescue/ Source0: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.bz2 -Source1: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.bz2.asc +# Source1: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.bz2.asc Source2: %{name}.keyring Source99: %{name}.changes # PATCH-FIX-UPSTREAM no-python2.patch sf#ddrescue#4 mc...@suse.com @@ -127,10 +127,7 @@ # avoid running dependency generation step touch .dep -# GCC 13 newly detects a violation of the strict aliasing rule: -# https://sourceforge.net/p/ddrescue/tickets/6/ -OPT_FLAGS="%{optflags} -fno-strict-aliasing" -%make_build RPM_OPT_FLAGS="$OPT_FLAGS" LIBDIR=%{_libdir} LIB=%{_lib} +%make_build RPM_OPT_FLAGS="%{optflags}" LIBDIR=%{_libdir} LIB=%{_lib} %install %make_install RPM_OPT_FLAGS="%{optflags}" INSTALLDIR=%{buildroot}/%{_bindir} LIB=%{_lib} LIBDIR=%{_libdir} \ ++++++ dd_rescue-1.99.12.tar.bz2 -> dd_rescue-1.99.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/Makefile new/dd_rescue-1.99.13/Makefile --- old/dd_rescue-1.99.12/Makefile 2022-07-26 15:31:58.000000000 +0200 +++ new/dd_rescue-1.99.13/Makefile 2023-02-24 09:28:08.000000000 +0100 @@ -2,7 +2,7 @@ # (c) garl...@suse.de, 99/10/09, GNU GPL # (c) k...@garloff.de, 2010 -- 2021, GNU GPL v2 or v3 -VERSION = 1.99.12 +VERSION = 1.99.13 DESTDIR = SRCDIR ?= . @@ -46,6 +46,7 @@ LDPIE = -pie RDYNAMIC = -rdynamic MAKE := $(MAKE) -f $(SRCDIR)/Makefile +STRIP ?= strip LZOP = $(shell type -p lzop || type -P true) HAVE_SHA256SUM = $(shell type -p sha256sum >/dev/null && echo 1 || echo 0) @@ -270,6 +271,9 @@ aes_c.po: $(SRCDIR)/aes_c.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< +aes.po: $(SRCDIR)/aes.c + $(CC) $(CFLAGS) -O2 $(PIC) -o $@ -c $< + # Default rules %.o: $(SRCDIR)/%.c config.h $(CC) $(CFLAGS) $(DEFINES) $(PIE) -c $< @@ -401,10 +405,10 @@ # Special pseudo targets strip: $(TARGETS) $(LIBTARGETS) - strip -S $^ + $(STRIP) -S $^ strip-all: $(OTHTARGETS) - strip -S $^ + $(STRIP) -S $^ clean: rm -f $(TARGETS) $(OTHTARGETS) $(OBJECTS) $(OBJECTS2) core test log *.o *.po *.cmp *.enc *.enc.old CHECKSUMS.* SALTS.* KEYS.* IVS.* .dep @@ -457,6 +461,9 @@ aes_c.o: $(SRCDIR)/aes_c.c $(CC) $(CFLAGS) $(PIE) $(FULL_UNROLL) -O3 -c $< +aes.o: $(SRCDIR)/aes.c + $(CC) $(CFLAGS) $(PIE) -O2 -c $< + aes_ossl.o: $(SRCDIR)/aes_ossl.c $(SRCDIR)/aes_ossl10.c $(SRCDIR)/aes_ossl11.c $(CC) $(CFLAGS) $(PIE) -O3 -c $< @@ -625,6 +632,7 @@ $(VG) ./sha256 /dev/null | sha256sum -c $(VG) ./sha384 /dev/null | sha384sum -c $(VG) ./sha512 /dev/null | sha512sum -c + $(VG) ./dd_rescue -q -c0 -a -b16k -t -L ./libddr_hash.so=sha256:outnm=- TEST2 /dev/null | $(VG) ./dd_rescue -c0 -a -b16k -t -L ./libddr_hash.so=sha256:chknm=- TEST2 /dev/null rm -f HASH.TEST CHECKSUMS.sha256 CHECKSUMS.sha512 TEST2 check_lzo: $(TARGETS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/Makefile.android.arm32abi28 new/dd_rescue-1.99.13/Makefile.android.arm32abi28 --- old/dd_rescue-1.99.12/Makefile.android.arm32abi28 2022-07-26 16:13:05.000000000 +0200 +++ new/dd_rescue-1.99.13/Makefile.android.arm32abi28 2023-02-23 22:51:27.000000000 +0100 @@ -53,7 +53,7 @@ move: all # Well, we can strip foreign binaries, luckily strip -S $(TGT) $(TGT_EXTRA) - mkdir -p android.arm64 - mv $(TGT) android.arm64/ - mv $(TGT_EXTRA) android.arm64/ + mkdir -p android.arm32abi28 + mv $(TGT) android.arm32abi28/ + mv $(TGT_EXTRA) android.arm32abi28/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/Makefile.android.arm64abi28 new/dd_rescue-1.99.13/Makefile.android.arm64abi28 --- old/dd_rescue-1.99.12/Makefile.android.arm64abi28 2022-07-26 15:57:32.000000000 +0200 +++ new/dd_rescue-1.99.13/Makefile.android.arm64abi28 2023-02-23 22:51:27.000000000 +0100 @@ -53,7 +53,7 @@ move: all # Well, we can strip foreign binaries, luckily strip -S $(TGT) $(TGT_EXTRA) - mkdir -p android.arm64 - mv $(TGT) android.arm64/ - mv $(TGT_EXTRA) android.arm64/ + mkdir -p android.arm64abi28 + mv $(TGT) android.arm64abi28/ + mv $(TGT_EXTRA) android.arm64abi28/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/REL-ID new/dd_rescue-1.99.13/REL-ID --- old/dd_rescue-1.99.12/REL-ID 2022-07-26 18:17:09.000000000 +0200 +++ new/dd_rescue-1.99.13/REL-ID 2023-02-24 09:34:09.000000000 +0100 @@ -1 +1 @@ -DD_RESCUE_1_99_12 +DD_RESCUE_1_99_13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/aes.h new/dd_rescue-1.99.13/aes.h --- old/dd_rescue-1.99.12/aes.h 2021-04-28 10:02:23.000000000 +0200 +++ new/dd_rescue-1.99.13/aes.h 2023-02-24 08:57:15.000000000 +0100 @@ -30,7 +30,7 @@ typedef unsigned char uchar; typedef unsigned int uint; typedef unsigned long ulong; - +//typedef unsigned long ulong_alias __attribute__((may_alias)); #define STP_ECB 0 #define STP_CBC 1 @@ -82,8 +82,8 @@ #define XORN(in1,in2,out,len) \ do { \ uint _i; \ - for (_i = 0; _i < len/sizeof(ulong); ++_i) \ - *((ulong*)(out)+_i) = *((ulong*)(in1)+_i) ^ *((ulong*)(in2)+_i); \ + for (_i = 0; _i < len/sizeof(uint); ++_i) \ + *((uint*)(out)+_i) = *((const uint*)(in1)+_i) ^ *((const uint*)(in2)+_i); \ } while(0) /* Generic functions */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/checksum_file.c new/dd_rescue-1.99.13/checksum_file.c --- old/dd_rescue-1.99.12/checksum_file.c 2021-04-14 10:23:02.000000000 +0200 +++ new/dd_rescue-1.99.13/checksum_file.c 2023-02-23 22:51:27.000000000 +0100 @@ -60,6 +60,7 @@ { char *lnbf = NULL; size_t lln = 0; + //size_t read = 0; char* bnm = basename((char*)nm); while (!feof_unlocked(f)) { char *fnm, *fwh; @@ -67,6 +68,13 @@ ssize_t n = getline(&lnbf, &lln, f); if (n <= 0) break; + /* For non-seekable files, track position to avoid returning pos == -1 */ + /* + if (pos < 0) { + pos = read; + read += n; + } + */ fwh = strchr(lnbf, ' '); if (!fwh) continue; @@ -101,9 +109,12 @@ { if (!fnm) return NULL; - if (!strcmp("-", fnm)) - return stdin; - else { + if (!strcmp("-", fnm)) { + if (!strcmp(mode, "w")) + return stdout; + else + return stdin; + } else { if (acc) { int fd; if (strcmp(mode, "w")) @@ -118,23 +129,33 @@ /* get chksum */ int get_chks(const char* cnm, const char* nm, char* chks, int wantedln) { - FILE *f = fopen_chks(cnm, "r", 0); + FILE *f; + char is_stdin = 0; + if (strcmp(cnm, "-")) + f = fopen_chks(cnm, "r", 0); + else { + f = stdin; + is_stdin = 1; + } if (!f) return -1; off_t err = find_chks(f, nm, chks, wantedln); - if (f != stdin) + if (!is_stdin) fclose(f); - return err < 0? err: 0; + //return err < 0? err: 0; + return err == -ENOENT? err: 0; } /* update chksum */ int upd_chks(const char* cnm, const char *nm, const char *chks, int acc) { errno = 0; - FILE *f = fopen_chks(cnm, "r+", 0); + FILE *f = NULL; int err = 0; char oldchks[MAXHASHSLN+2]; char* bnm = basename(nm); + if (strcmp(cnm, "-")) + f = fopen_chks(cnm, "r+", 0); if (!f) { errno = 0; f = fopen_chks(cnm, "w", acc); @@ -159,7 +180,8 @@ } } } - fclose(f); + if (f != stdout) + fclose(f); return err; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/dd_rescue.c new/dd_rescue-1.99.13/dd_rescue.c --- old/dd_rescue-1.99.12/dd_rescue.c 2022-01-09 18:27:45.000000000 +0100 +++ new/dd_rescue-1.99.13/dd_rescue.c 2023-02-23 22:51:27.000000000 +0100 @@ -1309,11 +1309,13 @@ } int offs; unsigned char* extrabuf = (unsigned char*)malloc(4096); + assert(extrabuf); int ebufall = 4096; for (offs = 0; offs < aln; offs += 1+strlen(attrs+offs)) { ssize_t itln = getxattr(inm, attrs+offs, NULL, 0); if (ebufall && itln > ebufall) { extrabuf = (unsigned char*)realloc(extrabuf, itln); + assert(extrabuf); ebufall = itln; } itln = getxattr(inm, attrs+offs, extrabuf, itln); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/ffs.h new/dd_rescue-1.99.13/ffs.h --- old/dd_rescue-1.99.12/ffs.h 2021-04-14 10:23:02.000000000 +0200 +++ new/dd_rescue-1.99.13/ffs.h 2023-02-23 22:51:27.000000000 +0100 @@ -116,9 +116,9 @@ res -= 32; vhi = vlo; } -#else +#else /* 32bit*/ unsigned int vhi = val; -#endif +#endif /* __WORDSIZE */ unsigned int mask = 0xffff0000; unsigned int shift = 16; while (shift > 0) { @@ -130,12 +130,14 @@ mask <<= shift; } return res; -#endif +#endif /* ARM */ } +#endif /* __BIG_ENDIAN */ + +#if defined(__i386__) || defined(__x86_64__) int myffs_sse42(unsigned long); int myffsl_sse42(unsigned long); -#endif - void probe_sse42(); +#endif #endif /* _FFS_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/fiemap.c new/dd_rescue-1.99.13/fiemap.c --- old/dd_rescue-1.99.12/fiemap.c 2015-04-15 10:56:38.000000000 +0200 +++ new/dd_rescue-1.99.13/fiemap.c 2023-02-23 22:51:27.000000000 +0100 @@ -372,7 +372,9 @@ ++errs; continue; } + assert(ext); char* dnm = devname(st.st_dev); + assert(dnm); if (*dnm) { fd2 = open/*64*/(dnm, O_RDONLY); if (fd2 < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/frandom.c new/dd_rescue-1.99.13/frandom.c --- old/dd_rescue-1.99.12/frandom.c 2021-04-14 10:23:02.000000000 +0200 +++ new/dd_rescue-1.99.13/frandom.c 2023-02-23 22:51:27.000000000 +0100 @@ -18,6 +18,7 @@ #include <string.h> #include <asm/errno.h> #include <unistd.h> +//#include <assert.h> #ifdef HAVE_CONFIG_H # include "config.h" @@ -119,8 +120,10 @@ struct frandom_state *state; state = (struct frandom_state *)malloc(sizeof(struct frandom_state)); + //assert(state); if (!state) - return NULL; + abort(); + //return NULL; init_rand_state(state, seedbf); if (!int_random_state) @@ -193,6 +196,7 @@ state = int_random_state; if (!state) state = (struct frandom_state *)frandom_init_lrand(0); + //assert(state); i = state->i; j = state->j; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/fuzz_lzo.c new/dd_rescue-1.99.13/fuzz_lzo.c --- old/dd_rescue-1.99.12/fuzz_lzo.c 2022-07-26 15:54:56.000000000 +0200 +++ new/dd_rescue-1.99.13/fuzz_lzo.c 2023-02-23 22:51:27.000000000 +0100 @@ -23,6 +23,8 @@ #include <stdint.h> #include <unistd.h> #include <fcntl.h> +#include <sys/stat.h> +#include <utime.h> #include <string.h> #include <netinet/in.h> //#include <sys/mman.h> @@ -39,6 +41,7 @@ fprintf(stderr, "Options:\n"); fprintf(stderr, " -h\t\tThis help\n"); fprintf(stderr, " -d\t\tEnable debug mode\n"); + fprintf(stderr, " -p\t\tCopy ownership, permissions, timestamps\n"); fprintf(stderr, " -b BLKSZ\tBlocksize while compressing\n"); fprintf(stderr, " -v/V XXX\tSet version/version to extract to hex XXX\n"); fprintf(stderr, " -m/l YYY\tSet method/level to YYY\n"); @@ -49,11 +52,14 @@ fprintf(stderr, " -x BLK:OFF=VAL\tSet byte at offset OFF in block BLK to VAL\n"); fprintf(stderr, " -U BLK\tBreaks the uncompressed cksum for block BLK\n"); fprintf(stderr, " -C BLK\tBreaks the compressed cksum for block BLK\n"); + fprintf(stderr, " When tweaks u/c/x happen to do no change, they invert the result\n"); exit(1); } int errors = 0; +int applied = 0; char debug = 0; +char copystamp = 0; enum disttype { NONE = 0, ULEN, CLEN, BYTE, UCKS, CCKS }; @@ -182,25 +188,34 @@ abort(); } -blk_dist_t* find_dist(LISTTYPE(blk_dist_t)* dlist, int blkno, enum disttype type, signed char fix) +LISTTYPE(blk_dist_t)* filter_dist(LISTTYPE(blk_dist_t)* dlist, int blkno, enum disttype type, signed char fix) { + LISTTYPE(blk_dist_t) *dist_matches = NULL; LISTTYPE(blk_dist_t) *dist; LISTFOREACH(dlist, dist) { blk_dist_t *dst = &LISTDATA(dist); if ((unsigned)blkno == dst->blkno && type == dst->dist && (fix == -1 || fix == dst->fixup)) - return dst; + LISTAPPEND(dist_matches, *dst, blk_dist_t); } - return NULL; + return dist_matches; } #define APPLY_DIST(TP, FIX, VAR, APPL) \ - dist = find_dist(dists, blk, TP, FIX); \ - if (dist) { \ + match_dists = filter_dist(dists, blk, TP, FIX); \ + LISTFOREACH(match_dists, dt) { \ + /*blk_dist_t **/dist = &LISTDATA(dt); \ fprintf(stderr, "Blk %i: " #VAR "(%x) " #APPL " %x\n", \ - blk, dist->offset, dist->val); \ + blk, dist->offset, dist->val); \ + uint32_t old = VAR; \ VAR APPL dist->val; \ - } + ++applied; \ + if (VAR == old) { \ + fprintf(stderr, " new value == old value %08x, inverting\n", old); \ + VAR ^= 0xffffffffUL; \ + } \ + } \ + LISTTREEDEL(match_dists, blk_dist_t) @@ -232,6 +247,7 @@ cln = rd; } blk_dist_t *dist; + LISTTYPE(blk_dist_t) *match_dists, *dt; /* Change bytes with fixing cmpr cksum */ APPLY_DIST(BYTE, 1, cbuf[dist->offset], =); uint32_t cadl = lzo_adler32(ADLER32_INIT_VALUE, cbuf, cln); @@ -244,6 +260,7 @@ APPLY_DIST(CLEN, -1, clen, =); /* Change ucksum+ccksum */ APPLY_DIST(UCKS, -1, uadl, ^=); + dist = NULL; APPLY_DIST(CCKS, -1, cadl, ^=); if (dist && cln == (unsigned)rd) { fprintf(stderr, "Blk %i: Tweaking compressed cksum not applied as block not compressed\n", blk); @@ -298,6 +315,37 @@ } +/** Copy ownership and permissions */ +int copyperm(int ifd, int ofd) +{ + int err; + mode_t fmode; + struct stat stbuf; + err = fstat(ifd, &stbuf); + if (err) + return err; + fmode = stbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX); + err = fchown(ofd, stbuf.st_uid, stbuf.st_gid); + if (err) + fmode &= ~(S_ISUID | S_ISGID); + err += fchmod(ofd, fmode); + return err; +} + +/** File time copy */ +int copytimes(const char* inm, const char* onm) +{ + int err; + struct stat stbuf; + struct utimbuf utbuf; + err = stat(inm, &stbuf); + if (err) + return err; + utbuf.actime = stbuf.st_atime; + utbuf.modtime = stbuf.st_mtime; + err = utime(onm, &utbuf); + return err; +} /* TODO: MULTIPART and sparse ... */ int main(int argc, char* argv[]) { @@ -311,7 +359,7 @@ char levl = 5; unsigned int flags = 0x03000003UL; /* UNIX | ADLER32_C | ADLER32_D */ int c; - while ((c = getopt(argc, argv, "hdb:v:V:m:l:n:f:u:c:x:U:C:!")) != -1) { + while ((c = getopt(argc, argv, "hdpb:v:V:m:l:n:f:u:c:x:U:C:!")) != -1) { switch (c) { case 'h': usage(); @@ -322,6 +370,9 @@ case 'd': debug = 1; break; + case 'p': + copystamp = 1; + break; case 'b': blksize = atoi(optarg); break; @@ -404,12 +455,23 @@ write_header(ofd, hname, hversion, extrvers, meth, levl, flags, hdr_fixup); compress(ifd, ofd, blksize, blk_dists); + if (copystamp) + copyperm(ifd, ofd); + close(ofd); close(ifd); + if (copystamp) + copytimes(iname, oname); + if (debug) dump_blkdists(blk_dists); + if (applied != LISTSIZE(blk_dists, blk_dist_t)) { + ++errors; + fprintf(stderr, "WARNING: Applied %i of %i tweaks\n", + applied, LISTSIZE(blk_dists, blk_dist_t)); + } LISTTREEDEL(blk_dists, blk_dist_t); return errors; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/libddr_hash.c new/dd_rescue-1.99.13/libddr_hash.c --- old/dd_rescue-1.99.12/libddr_hash.c 2021-04-14 10:23:02.000000000 +0200 +++ new/dd_rescue-1.99.13/libddr_hash.c 2023-02-23 22:51:27.000000000 +0100 @@ -214,6 +214,7 @@ state->alg = get_hashalg(state, param+10); else if (!memcmp(param, "hmacpwd=", 8)) { state->hmacpwd = (unsigned char*)malloc(MAX_HMACPWDLN); + assert(state->hmacpwd); state->hmacpln = strlen(param+8); if (state->hmacpln >= MAX_HMACPWDLN) state->hmacpln = MAX_HMACPWDLN-1; @@ -223,6 +224,7 @@ else if (!memcmp(param, "hmacpwdfd=", 10)) { int hfd = atol(param+10); state->hmacpwd = (unsigned char*)malloc(MAX_HMACPWDLN); + assert(state->hmacpwd); state->hmacpwd[MAX_HMACPWDLN-1] = 0; if (hfd == 0 && isatty(hfd)) { FPLOG(INPUT, "%s", "Enter HMAC password: "); @@ -243,6 +245,7 @@ continue; } state->hmacpwd = (unsigned char*)malloc(MAX_HMACPWDLN); + assert(state->hmacpwd); state->hmacpwd[MAX_HMACPWDLN-1] = 0; state->hmacpln = fread(state->hmacpwd, 1, MAX_HMACPWDLN-1, f); if (state->hmacpln <= 0) { @@ -273,6 +276,7 @@ #ifdef HAVE_XATTR if ((state->chk_xattr || state->set_xattr) && !state->xattr_name) { state->xattr_name = (char*)malloc(32); + assert(state->xattr_name); state->xnmalloc = 1; if (state->hmacpwd) snprintf(state->xattr_name, 32, "user.hmac.%s", state->alg->name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/rdrand.c new/dd_rescue-1.99.13/rdrand.c --- old/dd_rescue-1.99.12/rdrand.c 2022-07-25 17:45:07.000000000 +0200 +++ new/dd_rescue-1.99.13/rdrand.c 2023-02-23 22:51:27.000000000 +0100 @@ -47,7 +47,7 @@ volatile unsigned int _rdrand_res; void probe_rdrand() { - unsigned int val; + unsigned int val = 0; _rdrand32_step(&val); _rdrand_res = val; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/secmem.c new/dd_rescue-1.99.13/secmem.c --- old/dd_rescue-1.99.12/secmem.c 2022-01-09 18:27:45.000000000 +0100 +++ new/dd_rescue-1.99.13/secmem.c 2023-02-23 22:51:27.000000000 +0100 @@ -85,6 +85,7 @@ sec_fields *sf = (sec_fields*)ptr; sf->canary = 0xbeefdead; //fprintf(stderr, "secmem_init: Length=%zi\n", offsetof(sec_fields, canary)); + /* -fanalzyer considers this a mem leak, although we are supposed to return malloced mem */ return (sec_fields*)ptr; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/sha256.c new/dd_rescue-1.99.13/sha256.c --- old/dd_rescue-1.99.12/sha256.c 2022-07-25 17:45:07.000000000 +0200 +++ new/dd_rescue-1.99.13/sha256.c 2023-02-23 22:51:27.000000000 +0100 @@ -89,40 +89,43 @@ */ void sha256_64(const uint8_t* msg, hash_t* ctx) { - int i; /* for each chunk create a 64-entry message schedule array w[0..63] of 32-bit words */ uint32_t w[64]; +#ifdef __ANALYZER__ + /* -fanalyzer is not clever enough to see that initializing the first 16 ints is enough */ + memset(w, 0, sizeof(w)); +#endif /* copy chunk into first 16 words w[0..15] of the message schedule array */ #if 0 memcpy(w, msg, 64); #else #if defined(HAVE_UNALIGNED_HANDLING) - for (i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) w[i] = htonl(*(uint32_t*)(msg+4*i)); #else - for (i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) w[i] = to_int32_be(msg+4*i); #endif #endif /* Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: */ - for (i = 16; i < 64; ++i) { - uint32_t s0 = RIGHTROTATE(w[i-15], 7) ^ RIGHTROTATE(w[i-15], 18) ^ (w[i-15] >> 3); - uint32_t s1 = RIGHTROTATE(w[i-2], 17) ^ RIGHTROTATE(w[i-2] , 19) ^ (w[i-2] >> 10); + for (int i = 16; i < 64; ++i) { + const uint32_t s0 = RIGHTROTATE(w[i-15], 7) ^ RIGHTROTATE(w[i-15], 18) ^ (w[i-15] >> 3); + const uint32_t s1 = RIGHTROTATE(w[i-2], 17) ^ RIGHTROTATE(w[i-2] , 19) ^ (w[i-2] >> 10); w[i] = w[i-16] + s0 + w[i-7] + s1; } /* Initialize working variables to current hash value:*/ uint32_t a = ctx->sha256_h[0], b = ctx->sha256_h[1], c = ctx->sha256_h[2], d = ctx->sha256_h[3]; uint32_t e = ctx->sha256_h[4], f = ctx->sha256_h[5], g = ctx->sha256_h[6], h = ctx->sha256_h[7]; /* Compression function main loop: */ - for (i = 0; i < 64; ++i) { - uint32_t S1 = RIGHTROTATE(e, 6) ^ RIGHTROTATE(e, 11) ^ RIGHTROTATE(e, 25); - //uint32_t ch = (e & f) ^ ((~e) & g); - uint32_t ch = g ^ (e & (f ^ g)); - uint32_t temp1 = h + S1 + ch + k[i] + w[i]; - uint32_t S0 = RIGHTROTATE(a, 2) ^ RIGHTROTATE(a, 13) ^ RIGHTROTATE(a, 22); - //uint32_t maj = (a & b) ^ (a & c) ^ (b & c); - uint32_t maj = (a & b) | (c & (a | b)); - uint32_t temp2 = S0 + maj; + for (int i = 0; i < 64; ++i) { + const uint32_t S1 = RIGHTROTATE(e, 6) ^ RIGHTROTATE(e, 11) ^ RIGHTROTATE(e, 25); + //const uint32_t ch = (e & f) ^ ((~e) & g); + const uint32_t ch = g ^ (e & (f ^ g)); + const uint32_t temp1 = h + S1 + ch + k[i] + w[i]; + const uint32_t S0 = RIGHTROTATE(a, 2) ^ RIGHTROTATE(a, 13) ^ RIGHTROTATE(a, 22); + //const uint32_t maj = (a & b) ^ (a & c) ^ (b & c); + const uint32_t maj = (a & b) | (c & (a | b)); + const uint32_t temp2 = S0 + maj; h = g; g = f; f = e; e = d + temp1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/sha512.c new/dd_rescue-1.99.13/sha512.c --- old/dd_rescue-1.99.12/sha512.c 2022-07-25 17:45:07.000000000 +0200 +++ new/dd_rescue-1.99.13/sha512.c 2023-02-23 22:51:27.000000000 +0100 @@ -119,40 +119,43 @@ */ void sha512_128(const uint8_t* msg, hash_t* ctx) { - int i; /* for each chunk create a 80-entry message schedule array w[0..79] of 64-bit words */ uint64_t w[80]; +#ifdef __ANALYZER__ + /* -fanalyzer is not clever enough to see that initializing the first 16 ints is enough */ + memset(w, 0, sizeof(w)); +#endif /* copy chunk into first 16 words w[0..15] of the message schedule array */ #if 0 memcpy(w, msg, 64); #else #if defined(HAVE_UNALIGNED_HANDLING) - for (i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) w[i] = htonll(*(uint64_t*)(msg+8*i)); #else - for (i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) w[i] = to_int64_be(msg+8*i); #endif #endif /* Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array: */ - for (i = 16; i < 80; ++i) { - uint64_t s0 = RIGHTROTATE(w[i-15], 1) ^ RIGHTROTATE(w[i-15], 8) ^ (w[i-15] >> 7); - uint64_t s1 = RIGHTROTATE(w[i-2], 19) ^ RIGHTROTATE(w[i-2] ,61) ^ (w[i-2] >> 6); + for (int i = 16; i < 80; ++i) { + const uint64_t s0 = RIGHTROTATE(w[i-15], 1) ^ RIGHTROTATE(w[i-15], 8) ^ (w[i-15] >> 7); + const uint64_t s1 = RIGHTROTATE(w[i-2], 19) ^ RIGHTROTATE(w[i-2] ,61) ^ (w[i-2] >> 6); w[i] = w[i-16] + s0 + w[i-7] + s1; } /* Initialize working variables to current hash value:*/ uint64_t a = ctx->sha512_h[0], b = ctx->sha512_h[1], c = ctx->sha512_h[2], d = ctx->sha512_h[3]; uint64_t e = ctx->sha512_h[4], f = ctx->sha512_h[5], g = ctx->sha512_h[6], h = ctx->sha512_h[7]; /* Compression function main loop: */ - for (i = 0; i < 80; ++i) { - uint64_t S1 = RIGHTROTATE(e, 14) ^ RIGHTROTATE(e, 18) ^ RIGHTROTATE(e, 41); - //uint64_t ch = (e & f) ^ ((~e) & g); - uint64_t ch = g ^ (e & (f ^ g)); - uint64_t temp1 = h + S1 + ch + k[i] + w[i]; - uint64_t S0 = RIGHTROTATE(a, 28) ^ RIGHTROTATE(a, 34) ^ RIGHTROTATE(a, 39); - //uint64_t maj = (a & b) ^ (a & c) ^ (b & c); - uint64_t maj = (a & b) | (c & (a | b)); - uint64_t temp2 = S0 + maj; + for (int i = 0; i < 80; ++i) { + const uint64_t S1 = RIGHTROTATE(e, 14) ^ RIGHTROTATE(e, 18) ^ RIGHTROTATE(e, 41); + //const uint64_t ch = (e & f) ^ ((~e) & g); + const uint64_t ch = g ^ (e & (f ^ g)); + const uint64_t temp1 = h + S1 + ch + k[i] + w[i]; + const uint64_t S0 = RIGHTROTATE(a, 28) ^ RIGHTROTATE(a, 34) ^ RIGHTROTATE(a, 39); + //const uint64_t maj = (a & b) ^ (a & c) ^ (b & c); + const uint64_t maj = (a & b) | (c & (a | b)); + const uint64_t temp2 = S0 + maj; h = g; g = f; f = e; e = d + temp1; @@ -204,8 +207,7 @@ unsigned char* sha5xx_beout(unsigned char *buf, const hash_t *ctx, int wd) { assert(buf); - int i; - for (i = 0; i < wd; ++i) + for (int i = 0; i < wd; ++i) *((uint64_t*)buf+i) = htonll(ctx->sha512_h[i]); return buf; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.12/test_lzo_fuzz.sh new/dd_rescue-1.99.13/test_lzo_fuzz.sh --- old/dd_rescue-1.99.12/test_lzo_fuzz.sh 2021-05-01 11:39:55.000000000 +0200 +++ new/dd_rescue-1.99.13/test_lzo_fuzz.sh 2023-02-23 22:51:27.000000000 +0100 @@ -43,8 +43,8 @@ test_fuzz 1 1 "" 16384 -U2 test_fuzz 1 1 "=nodiscard" 0 -U2 test_fuzz 1 1 "=nodiscard" 0 -C2 -test_fuzz 1 5 "" 16384 -x1:0x6fe=0x1a -test_fuzz 1 6 "=nodiscard" 16384 -x1:0x6fe=0x1a +test_fuzz 1 5 "" 16384 -x1:0x2fe=0x1a -x1:0x620=0xfe +test_fuzz 1 6 "=nodiscard" 16384 -x1:0x2fe=0x1a -x1:0x620=0xfe test_fuzz 1 131 "" 16384 -u2=8192 test_fuzz 1 131 "" 100000 -c1=8192 # TODO: A lot more tests, with and without nodiscard