Lucio Andrés Illanes Albornoz (arab, vxp) f16177
--- a/libarchive/archive_openssl_hmac_private.h.orig	2018-03-22 20:47:12 UTC
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
+++ b/libarchive/archive_openssl_hmac_private.h
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
@@ -28,7 +28,8 @@
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 #include <openssl/hmac.h>
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 #include <openssl/opensslv.h>
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
+    (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 #include <stdlib.h> /* malloc, free */
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 #include <string.h> /* memset */
Lucio Andrés Illanes Albornoz (arab, vxp) f16177
 static inline HMAC_CTX *HMAC_CTX_new(void)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
From fa7438a0ff4033e4741c807394a9af6207940d71 Mon Sep 17 00:00:00 2001
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
From: Joerg Sonnenberger <joerg@bec.de>
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
Date: Tue, 5 Sep 2017 18:12:19 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
Subject: [PATCH] Do something sensible for empty strings to make fuzzers
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 happy.
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
---
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 libarchive/archive_read_support_format_xar.c | 8 +++++++-
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 1 file changed, 7 insertions(+), 1 deletion(-)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
index 7a22beb9d..93eeacc5e 100644
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
--- a/libarchive/archive_read_support_format_xar.c
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+++ b/libarchive/archive_read_support_format_xar.c
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
@@ -1040,6 +1040,9 @@ atol10(const char *p, size_t char_cnt)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	uint64_t l;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	int digit;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+	if (char_cnt == 0)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+		return (0);
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	l = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	digit = *p - '0';
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	while (digit >= 0 && digit < 10  && char_cnt-- > 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
@@ -1054,7 +1057,10 @@ atol8(const char *p, size_t char_cnt)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 {
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	int64_t l;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	int digit;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
-        
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+	if (char_cnt == 0)
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+		return (0);
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
+
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	l = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 	while (char_cnt-- > 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) f4185f
 		if (*p >= '0' && *p <= '7')