Module Name: othersrc
Committed By: agc
Date: Tue Jul 26 04:24:27 UTC 2016
Modified Files:
othersrc/external/bsd/delta/dist: delta.1 delta.h libdelta.c main.c
Log Message:
Update delta to version 20160725 in light of the SA to bspatch at
https://www.freebsd.org/security/advisories/FreeBSD-SA-16:25.bspatch.asc
+ check for negative offsets provided in the binary patch file.
Bug reported (independently) by The Chromium Project and Lu Ting-Pin.
+ add a -V option to delta to print the version number of the
delta(1) utility to stderr, and then exit
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/delta/dist/delta.1 \
othersrc/external/bsd/delta/dist/delta.h \
othersrc/external/bsd/delta/dist/libdelta.c \
othersrc/external/bsd/delta/dist/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/external/bsd/delta/dist/delta.1
diff -u othersrc/external/bsd/delta/dist/delta.1:1.1 othersrc/external/bsd/delta/dist/delta.1:1.2
--- othersrc/external/bsd/delta/dist/delta.1:1.1 Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/delta.1 Tue Jul 26 04:24:27 2016
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.1,v 1.1 2005/08/06 01:59:05 cperciva Exp $
.\"
-.Dd April 14, 2016
+.Dd July 25, 2016
.Dt DELTA 1
.Os
.Sh NAME
@@ -33,7 +33,7 @@
.Nd manage deltas between two binary files
.Sh SYNOPSIS
.Nm
-.Op Fl dp
+.Op Fl Vdp
.Ar oldfile newfile patchfile
.Sh DESCRIPTION
.Nm
Index: othersrc/external/bsd/delta/dist/delta.h
diff -u othersrc/external/bsd/delta/dist/delta.h:1.1 othersrc/external/bsd/delta/dist/delta.h:1.2
--- othersrc/external/bsd/delta/dist/delta.h:1.1 Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/delta.h Tue Jul 26 04:24:27 2016
@@ -23,7 +23,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DELTA_H_
-#define DELTA_H_ 20160414
+#define DELTA_H_ 20160725
+
+#define DELTA_VERSION "20160725"
struct delta_t;
typedef struct delta_t delta_t;
Index: othersrc/external/bsd/delta/dist/libdelta.c
diff -u othersrc/external/bsd/delta/dist/libdelta.c:1.1 othersrc/external/bsd/delta/dist/libdelta.c:1.2
--- othersrc/external/bsd/delta/dist/libdelta.c:1.1 Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/libdelta.c Tue Jul 26 04:24:27 2016
@@ -659,9 +659,14 @@ delta_patch_mem(delta_t *delta, const vo
ctrl[i] = get64(&delta->control.v[ctlc], &len);
ctlc += len;
}
+ /* sanity check for negative offsets */
+ if (ctrl[0] < 0 || ctrl[1] < 0) {
+ warnx("negative offset, found corrupt patch");
+ return 0;
+ }
/* Sanity-check */
if (newpos + ctrl[0] > delta->newsize) {
- warnx("Corrupt patch 1\n");
+ warnx("Corrupt patch 1");
return 0;
}
/* Read diff string */
@@ -678,7 +683,7 @@ delta_patch_mem(delta_t *delta, const vo
oldpos += ctrl[0];
/* Sanity-check */
if (newpos + ctrl[1] > delta->newsize) {
- warnx("Corrupt patch 2\n");
+ warnx("Corrupt patch 2");
return 0;
}
/* Read extra string */
Index: othersrc/external/bsd/delta/dist/main.c
diff -u othersrc/external/bsd/delta/dist/main.c:1.1 othersrc/external/bsd/delta/dist/main.c:1.2
--- othersrc/external/bsd/delta/dist/main.c:1.1 Thu Apr 28 05:21:31 2016
+++ othersrc/external/bsd/delta/dist/main.c Tue Jul 26 04:24:27 2016
@@ -39,8 +39,11 @@ main(int argc, char **argv)
int i;
dodiff = 0;
- while ((i = getopt(argc, argv, "dp")) != -1) {
+ while ((i = getopt(argc, argv, "Vdp")) != -1) {
switch(i) {
+ case 'V':
+ fprintf(stderr, "delta-%s\n", DELTA_VERSION);
+ exit(EXIT_SUCCESS);
case 'd':
dodiff = 1;
break;