diff options
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/Makefile.am | 1 | ||||
-rw-r--r-- | xdelta3/configure.ac | 3 | ||||
-rwxr-xr-x | xdelta3/run_release.sh | 11 | ||||
-rw-r--r-- | xdelta3/xdelta3-decode.h | 21 | ||||
-rw-r--r-- | xdelta3/xdelta3-internal.h | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am index 6fe2b74..7d00a9b 100644 --- a/xdelta3/Makefile.am +++ b/xdelta3/Makefile.am | |||
@@ -4,7 +4,6 @@ bin_PROGRAMS = xdelta3 | |||
4 | noinst_PROGRAMS = xdelta3regtest xdelta3decode | 4 | noinst_PROGRAMS = xdelta3regtest xdelta3decode |
5 | 5 | ||
6 | export AFL_HARDEN | 6 | export AFL_HARDEN |
7 | export AFL_USE_ASAN | ||
8 | 7 | ||
9 | common_SOURCES = \ | 8 | common_SOURCES = \ |
10 | xdelta3-blkcache.h \ | 9 | xdelta3-blkcache.h \ |
diff --git a/xdelta3/configure.ac b/xdelta3/configure.ac index c3a0b3d..ce24045 100644 --- a/xdelta3/configure.ac +++ b/xdelta3/configure.ac | |||
@@ -5,9 +5,6 @@ AC_CONFIG_MACRO_DIR([m4]) | |||
5 | LT_INIT | 5 | LT_INIT |
6 | AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar subdir-objects]) | 6 | AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar subdir-objects]) |
7 | 7 | ||
8 | AC_ARG_VAR(AFL_HARDEN, "Use hardened AFL") | ||
9 | AC_ARG_VAR(AFL_USE_ASAN, "Use ASAN with AFL") | ||
10 | |||
11 | AX_CHECK_ALIGNED_ACCESS_REQUIRED | 8 | AX_CHECK_ALIGNED_ACCESS_REQUIRED |
12 | AC_PROG_CC | 9 | AC_PROG_CC |
13 | AC_PROG_CXX | 10 | AC_PROG_CXX |
diff --git a/xdelta3/run_release.sh b/xdelta3/run_release.sh index 4b45124..c4eb802 100755 --- a/xdelta3/run_release.sh +++ b/xdelta3/run_release.sh | |||
@@ -107,19 +107,12 @@ function buildit { | |||
107 | local BM="${host}${march}" | 107 | local BM="${host}${march}" |
108 | local USECC="${CC}" | 108 | local USECC="${CC}" |
109 | local USECXX="${CXX}" | 109 | local USECXX="${CXX}" |
110 | local ASAN="0" | ||
111 | local LIBBM="${BM}" | 110 | local LIBBM="${BM}" |
112 | 111 | ||
113 | if [ "${afl}" = "1" ]; then | 112 | if [ "${afl}" = "1" ]; then |
114 | USECC="afl-gcc" | 113 | USECC="afl-gcc" |
115 | USECXX="afl-g++" | 114 | USECXX="afl-g++" |
116 | BM="${BM}-afl" | 115 | BM="${BM}-afl" |
117 | |||
118 | if [ "${march}" = "-m32" ]; then | ||
119 | ASAN="1" | ||
120 | BM="${BM}-asan" | ||
121 | cargs="${cargs} -fno-omit-frame-pointer -fsanitize=address" | ||
122 | fi | ||
123 | fi | 116 | fi |
124 | 117 | ||
125 | local D="build/${BM}/xoff${offsetbits}" | 118 | local D="build/${BM}/xoff${offsetbits}" |
@@ -185,9 +178,7 @@ EOF | |||
185 | "CXXFLAGS=${CXXFLAGS}" \ | 178 | "CXXFLAGS=${CXXFLAGS}" \ |
186 | "LDFLAGS=${LDFLAGS}" \ | 179 | "LDFLAGS=${LDFLAGS}" \ |
187 | "CC=${USECC}" \ | 180 | "CC=${USECC}" \ |
188 | "CXX=${USECXX}" \ | 181 | "CXX=${USECXX}" |
189 | "AFL_HARDEN=${afl}" \ | ||
190 | "AFL_USE_ASAN=${ASAN}" | ||
191 | if [ $? -ne 0 ]; then | 182 | if [ $? -ne 0 ]; then |
192 | return | 183 | return |
193 | fi | 184 | fi |
diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h index 19bf208..6ec200f 100644 --- a/xdelta3/xdelta3-decode.h +++ b/xdelta3/xdelta3-decode.h | |||
@@ -625,10 +625,23 @@ xd3_decode_sections (xd3_stream *stream) | |||
625 | return xd3_decode_finish_window (stream); | 625 | return xd3_decode_finish_window (stream); |
626 | } | 626 | } |
627 | 627 | ||
628 | /* To avoid copying, need this much data available */ | 628 | /* To avoid extra copying, allocate three sections at once (but |
629 | need = (stream->inst_sect.size + | 629 | * check for overflow). */ |
630 | stream->addr_sect.size + | 630 | need = stream->inst_sect.size; |
631 | stream->data_sect.size); | 631 | |
632 | if (USIZE_T_OVERFLOW (need, stream->addr_sect.size)) | ||
633 | { | ||
634 | stream->msg = "decoder section size overflow"; | ||
635 | return XD3_INTERNAL; | ||
636 | } | ||
637 | need += stream->addr_sect.size; | ||
638 | |||
639 | if (USIZE_T_OVERFLOW (need, stream->data_sect.size)) | ||
640 | { | ||
641 | stream->msg = "decoder section size overflow"; | ||
642 | return XD3_INTERNAL; | ||
643 | } | ||
644 | need += stream->data_sect.size; | ||
632 | 645 | ||
633 | /* The window may be entirely processed. */ | 646 | /* The window may be entirely processed. */ |
634 | XD3_ASSERT (stream->dec_winbytes <= need); | 647 | XD3_ASSERT (stream->dec_winbytes <= need); |
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h index 244192c..d6eb0ac 100644 --- a/xdelta3/xdelta3-internal.h +++ b/xdelta3/xdelta3-internal.h | |||
@@ -221,7 +221,7 @@ void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); | |||
221 | \ | 221 | \ |
222 | do \ | 222 | do \ |
223 | { \ | 223 | { \ |
224 | if (inp == max) \ | 224 | if (inp == maxp) \ |
225 | { \ | 225 | { \ |
226 | stream->msg = "end-of-input in read_integer"; \ | 226 | stream->msg = "end-of-input in read_integer"; \ |
227 | return XD3_INVALID_INPUT; \ | 227 | return XD3_INVALID_INPUT; \ |
@@ -281,7 +281,7 @@ xd3_decode_uint32_t (xd3_stream *stream, uint32_t *val) | |||
281 | 281 | ||
282 | static inline int | 282 | static inline int |
283 | xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp, | 283 | xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp, |
284 | const uint8_t *max, uint32_t *valp) | 284 | const uint8_t *maxp, uint32_t *valp) |
285 | { READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK); } | 285 | { READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK); } |
286 | 286 | ||
287 | #if XD3_ENCODER | 287 | #if XD3_ENCODER |
@@ -306,7 +306,7 @@ xd3_emit_uint64_t (xd3_stream *stream, xd3_output **output, uint64_t num) | |||
306 | #if REGRESSION_TEST | 306 | #if REGRESSION_TEST |
307 | static int | 307 | static int |
308 | xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp, | 308 | xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp, |
309 | const uint8_t *max, uint64_t *valp) | 309 | const uint8_t *maxp, uint64_t *valp) |
310 | { READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK); } | 310 | { READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK); } |
311 | 311 | ||
312 | static uint32_t | 312 | static uint32_t |