15 Commits

Author SHA1 Message Date
Xavier Roche
b75488dec6 created tag 3.48.19 2014-07-28 21:16:18 +00:00
Xavier Roche
9285cfa1bb 3.48.19 2014-07-28 21:02:00 +00:00
Xavier Roche
02eb2862d2 Added testcase for 'strlen(copyBuff) == qLen failed at htslib.c:3458' 2014-07-28 20:56:57 +00:00
Xavier Roche
0ac9c0df32 Fixed 'strlen(copyBuff) == qLen failed at htslib.c:3458' assertion failure.
Rationale: strncat(..., ..., (size_t) -1) does not behave gently on Linux, and is not equivalent to strcat(..., ...) when using optimizations (could it be a corner-case bug ?)
2014-07-28 20:56:38 +00:00
Xavier Roche
da41e9a7a1 Additional message when crashing to report the issue. 2014-07-20 09:19:50 +00:00
Xavier Roche
b9a35a5d9c closes:#755107 2014-07-17 20:01:10 +00:00
Xavier Roche
f2ac631565 3.48.18 2014-07-17 19:52:35 +00:00
Xavier Roche
b5e08a8300 Fixed infamous crashes inside the DNS cache due to a corruption within the option structure (E.Kalinowski)
This long-lasting bug was a real pain to hunt! :)
2014-07-17 19:30:53 +00:00
Xavier Roche
1d2d42eb4e assert => assertf 2014-07-17 18:41:29 +00:00
Xavier Roche
d71237d177 Cache cleanup. Added assert() 2014-07-17 18:39:16 +00:00
Xavier Roche
7f8eb5f60f Warning fix. 2014-07-17 18:38:59 +00:00
Xavier Roche
e1149999ce Fixed WIN32 2014-07-14 11:55:28 +00:00
Xavier Roche
89a8c3134d Cosmetic 2014-07-14 08:11:00 +00:00
Xavier Roche
5261673a4d Fixed typo. 2014-07-14 08:10:06 +00:00
Xavier Roche
1b5adaaa2d Added stack trace on Linux when crashing for httrack 2014-07-14 08:08:55 +00:00
12 changed files with 212 additions and 56 deletions

57
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for httrack 3.48.17.
# Generated by GNU Autoconf 2.69 for httrack 3.48.19.
#
# Report bugs to <roche+packaging@httrack.com>.
#
@@ -616,8 +616,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='httrack'
PACKAGE_TARNAME='httrack'
PACKAGE_VERSION='3.48.17'
PACKAGE_STRING='httrack 3.48.17'
PACKAGE_VERSION='3.48.19'
PACKAGE_STRING='httrack 3.48.19'
PACKAGE_BUGREPORT='roche+packaging@httrack.com'
PACKAGE_URL='http://www.httrack.com/'
@@ -1356,7 +1356,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures httrack 3.48.17 to adapt to many kinds of systems.
\`configure' configures httrack 3.48.19 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1426,7 +1426,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of httrack 3.48.17:";;
short | recursive ) echo "Configuration of httrack 3.48.19:";;
esac
cat <<\_ACEOF
@@ -1537,7 +1537,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
httrack configure 3.48.17
httrack configure 3.48.19
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2169,7 +2169,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by httrack $as_me 3.48.17, which was
It was created by httrack $as_me 3.48.19, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2990,7 +2990,7 @@ fi
# Define the identity of the package.
PACKAGE='httrack'
VERSION='3.48.17'
VERSION='3.48.19'
cat >>confdefs.h <<_ACEOF
@@ -12246,6 +12246,43 @@ else
fi
## Export all symbols for backtraces
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -rdynamic" >&5
$as_echo_n "checking whether C compiler accepts -rdynamic... " >&6; }
if ${ax_cv_check_cflags___rdynamic+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -rdynamic"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ax_cv_check_cflags___rdynamic=yes
else
ax_cv_check_cflags___rdynamic=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___rdynamic" >&5
$as_echo "$ax_cv_check_cflags___rdynamic" >&6; }
if test x"$ax_cv_check_cflags___rdynamic" = xyes; then :
DEFAULT_CFLAGS="$DEFAULT_CFLAGS -rdynamic"
else
:
fi
### Check for -fvisibility=hidden support
@@ -13987,7 +14024,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by httrack $as_me 3.48.17, which was
This file was extended by httrack $as_me 3.48.19, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14054,7 +14091,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
httrack config.status 3.48.17
httrack config.status 3.48.19
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@@ -1,6 +1,6 @@
AC_PREREQ(2.59)
AC_INIT([httrack], [3.48.17], [roche+packaging@httrack.com], [httrack], [http://www.httrack.com/])
AC_INIT([httrack], [3.48.19], [roche+packaging@httrack.com], [httrack], [http://www.httrack.com/])
AC_COPYRIGHT([
HTTrack Website Copier, Offline Browser for Windows and Unix
Copyright (C) 1998-2014 Xavier Roche and other contributors
@@ -76,6 +76,9 @@ AX_CHECK_COMPILE_FLAG([-fstrict-aliasing -Wstrict-aliasing], [DEFAULT_CFLAGS="$D
AX_CHECK_LINK_FLAG([-Wl,--discard-all], [DEFAULT_LDLAGS="$DEFAULT_LDLAGS -Wl,--discard-all"])
AX_CHECK_LINK_FLAG([-Wl,--no-undefined], [DEFAULT_LDLAGS="$DEFAULT_LDLAGS -Wl,--no-undefined"])
## Export all symbols for backtraces
AX_CHECK_COMPILE_FLAG([-rdynamic], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS -rdynamic"])
### Check for -fvisibility=hidden support
gl_VISIBILITY
AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"

14
debian/changelog vendored
View File

@@ -1,3 +1,17 @@
httrack (3.48.19-1) unstable; urgency=low
* Updated to 3.48.19 (3.48-19)
closes:#756328
-- Xavier Roche <xavier@debian.org> Mon, 28 Jul 2014 22:52:19 +0200
httrack (3.48.18-1) unstable; urgency=low
* Updated to 3.48.18 (3.48-18)
closes:#755107
-- Xavier Roche <xavier@debian.org> Thu, 17 Jul 2014 21:35:10 +0200
httrack (3.48.17-1) unstable; urgency=low
* Updated to 3.48.17 (3.48-17)

View File

@@ -4,7 +4,10 @@ HTTrack Website Copier release history:
This file lists all changes and fixes that have been made for HTTrack.
3.48-17
3.48-19
+ Fixed: assertion failure at htslib.c:3458 (strlen(copyBuff) == qLen) seen on Linux
+ Fixed: infamous crashes inside the DNS cache due to a corruption within the option structure (E.Kalinowski/karbofos)
+ New: added minimalistic crash reporting on Windows and Linux
+ Fixed: URL list not working anymore (tom swift)
+ Fixed: FTBFS on ARM
+ Fixed: buggy FFFD (replacement character) in place of leading non-ascii character such as Chinese ones (aballboy)

View File

@@ -1,7 +1,7 @@
.\" Process this file with
.\" groff -man -Tascii httrack.1
.\"
.TH httrack 1 "12 July 2014" "httrack website copier"
.TH httrack 1 "17 July 2014" "httrack website copier"
.SH NAME
httrack \- offline browser : copy websites to a local directory
.SH SYNOPSIS

View File

@@ -130,6 +130,16 @@ HTSEXT_API int hts_main(int argc, char **argv) {
return ret;
}
// very minimalistic internal tests
static void basic_selftests(void) {
// BUG 756328
const char *const source = "/intent/tweet?url=https%3A%2F%2Fwww.httrack.com%2Fvacatures%2F1562519%2Fmedewerker-data-services&text=Medewerker+Data+Services&via=httrackcom";
char buffer[1024];
fil_normalized(source, buffer);
// MD5 selftests
md5selftest();
}
static int hts_main_internal(int argc, char **argv, httrackp * opt);
// Main, récupère les paramètres et appelle le robot
@@ -2432,7 +2442,7 @@ static int hts_main_internal(int argc, char **argv, httrackp * opt) {
return 0;
break;
case '7': // hashtable selftest: httrack -#7 nb_entries
md5selftest();
basic_selftests();
if (++na < argc) {
char *const snum = strdup(argv[na]);
unsigned long count = 0;

View File

@@ -36,8 +36,8 @@ Please visit our Website: http://www.httrack.com
#define HTTRACK_GLOBAL_DEFH
// Version (also check external version information)
#define HTTRACK_VERSION "3.48-17"
#define HTTRACK_VERSIONID "3.48.17"
#define HTTRACK_VERSION "3.48-19"
#define HTTRACK_VERSIONID "3.48.19"
#define HTTRACK_AFF_VERSION "3.x"
#define HTTRACK_LIB_VERSION "2.0"

View File

@@ -4526,6 +4526,8 @@ t_dnscache *hts_cache(httrackp * opt) {
memset(opt->state.dns_cache, 0, sizeof(t_dnscache));
}
assertf(opt->state.dns_cache != NULL);
/* first entry is NULL */
assertf(opt->state.dns_cache->iadr == NULL);
return opt->state.dns_cache;
}
@@ -4534,8 +4536,8 @@ void hts_cache_free(t_dnscache *const root) {
if (root != NULL) {
t_dnscache *cache;
for(cache = root; cache != NULL; ) {
t_dnscache *const next = cache->n;
cache->n = NULL;
t_dnscache *const next = cache->next;
cache->next = NULL;
freet(cache);
cache = next;
}
@@ -4556,14 +4558,19 @@ static SOCaddr* hts_ghbn(const t_dnscache *cache, const char *const iadr, SOCadd
if (*iadr == '\0') {
return NULL;
}
for(; cache != NULL; cache = cache->n) {
/* first entry is empty */
if (cache->iadr == NULL) {
cache = cache->next;
}
for(; cache != NULL; cache = cache->next) {
assertf(cache != NULL);
if (cache->iadr != NULL && strcmp(cache->iadr, iadr) == 0) { // ok trouvé
if (cache->host_length > 0) { // entrée valide
assertf(cache->iadr != NULL);
assertf(cache->iadr == (const char*) cache + sizeof(t_dnscache));
if (strcmp(cache->iadr, iadr) == 0) { // ok trouvé
if (cache->host_length != 0) { // entrée valide
assertf(cache->host_length <= sizeof(cache->host_addr));
SOCaddr_copyaddr2(*addr, cache->host_addr, cache->host_length);
return addr;
} else if (cache->host_length == 0) { // en cours
return NULL;
} else { // erreur dans le dns, déja vérifié
SOCaddr_clear(*addr);
return addr;
@@ -4684,8 +4691,11 @@ static SOCaddr* hts_dns_resolve_(httrackp * opt, const char *_iadr,
if (sa != NULL) {
return SOCaddr_is_valid(*sa) ? sa : NULL;
} else { // non présent dans le cache dns, tester
const size_t iadr_len = strlen(iadr) + 1;
char *block;
// find queue
for(; cache->n != NULL; cache = cache->n) ;
for(; cache->next != NULL; cache = cache->next) ;
#if DEBUGDNS
printf("resolving (not cached) %s\n", iadr);
@@ -4698,19 +4708,21 @@ static SOCaddr* hts_dns_resolve_(httrackp * opt, const char *_iadr,
#endif
/* attempt to store new entry */
cache->n = (t_dnscache *) calloct(1, sizeof(t_dnscache));
if (cache->n != NULL) {
t_dnscache *const next = cache->n;
strcpybuff(next->iadr, iadr);
block = malloct(sizeof(t_dnscache) + iadr_len);
cache->next = (t_dnscache *) block;
if (cache->next != NULL) {
t_dnscache *const next = cache->next;
char *str = block + sizeof(t_dnscache);
memcpy(str, iadr, iadr_len);
next->iadr = str;
if (sa != NULL) {
next->host_length = SOCaddr_size(*sa);
assertf(next->host_length < sizeof(next->host_addr));
assertf(next->host_length <= sizeof(next->host_addr));
memcpy(next->host_addr, &SOCaddr_sockaddr(*sa), next->host_length);
} else {
next->host_addr[0] = '\0';
next->host_length = 0; // non existant dans le dns
}
next->n = NULL;
next->next = NULL;
return sa;
}

View File

@@ -148,12 +148,10 @@ struct OLD_htsblk {
typedef struct t_dnscache t_dnscache;
#endif
struct t_dnscache {
struct t_dnscache *n;
int host_length; // 4 normalement - ==0 alors en cours de résolution
char host_addr[HTS_MAXADDRLEN]; // 4 octets (v4), ou 16 octets (v6)
// ou >16 si sockaddr
// ==-1 alors erreur (host n'éxiste pas)
char iadr[1024];
struct t_dnscache *next;
const char *iadr;
size_t host_length; // length ; (4 or 16) ; 0 for error
char host_addr[HTS_MAXADDRLEN];
};
/* Library internal definictions */

View File

@@ -130,11 +130,23 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) {
*/
#define strncatbuff(A, B, N) \
( HTS_IS_NOT_CHAR_BUFFER(A) \
? strncat(A, B, N) \
? ( (N) != (size_t) -1 ? strncat(A, B, N) : strcat(A, B) ) \
: strncat_safe_(A, sizeof(A), B, \
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), N, \
"overflow while appending '" #B "' to '"#A"'", __FILE__, __LINE__) )
/**
* Append characters of "B" to "A".
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
* is assumed to be the capacity of this array.
*/
#define strcatbuff(A, B) \
( HTS_IS_NOT_CHAR_BUFFER(A) \
? strcat(A, B) \
: strncat_safe_(A, sizeof(A), B, \
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), (size_t) -1, \
"overflow while appending '" #B "' to '"#A"'", __FILE__, __LINE__) )
/**
* Copy characters from "B" to "A".
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
@@ -147,15 +159,6 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) {
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), \
"overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__) )
/* note: "size_t is an unsigned integral type" */
/**
* Append characters of "B" to "A".
* If "A" is a char[] variable whose size is not sizeof(char*), then the size
* is assumed to be the capacity of this array.
*/
#define strcatbuff(A, B) strncatbuff(A, B, (size_t) -1)
/**
* Append characters of "B" to "A", "A" having a maximum capacity of "S".
*/
@@ -188,6 +191,7 @@ static HTS_INLINE HTS_UNUSED char* strncat_safe_(char *const dest, const size_t
const char *exp, const char *file, int line) {
const size_t source_len = strlen_safe_(source, sizeof_source, file, line);
const size_t dest_len = strlen_safe_(dest, sizeof_dest, file, line);
/* note: "size_t is an unsigned integral type" ((size_t) -1 is positive) */
const size_t source_copy = source_len <= n ? source_len : n;
const size_t dest_final_len = dest_len + source_copy;
assertf__(dest_final_len < sizeof_dest, exp, file, line);

View File

@@ -536,21 +536,20 @@ void longfile_to_83(int mode, char *n83, char *save) {
// écrire backblue.gif
/* Note: utf-8 */
int verif_backblue(httrackp * opt, const char *base) {
int *done = &opt->state.verif_backblue_done;
int ret = 0;
//
if (!base) { // init
*done = 0;
opt->state.verif_backblue_done = 0;
return 0;
}
if ((!*done)
if ((!opt->state.verif_backblue_done)
|| (fsize_utf8(fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "backblue.gif")) !=
HTS_DATA_BACK_GIF_LEN)) {
FILE *fp =
filecreate(&opt->state.strc,
fconcat(OPT_GET_BUFF(opt), OPT_GET_BUFF_SIZE(opt), base, "backblue.gif"));
*done = 1;
opt->state.verif_backblue_done = 1;
if (fp) {
if (fwrite(HTS_DATA_BACK_GIF, HTS_DATA_BACK_GIF_LEN, 1, fp) !=
HTS_DATA_BACK_GIF_LEN)
@@ -579,12 +578,12 @@ int verif_backblue(httrackp * opt, const char *base) {
// flag
int verif_external(httrackp * opt, int nb, int test) {
int *status = &opt->state.verif_external_status;
const int flag = 1 << nb;
int *const status = &opt->state.verif_external_status;
if (!test)
status[nb] = 0; // reset
else if (!status[nb]) {
status[nb] = 1;
*status &= ~flag; // reset
else if ((*status & flag) == 0) {
*status |= flag;
return 1;
}
return 0;

View File

@@ -69,6 +69,9 @@ static int linput(FILE * fp, char *s, int max);
#include <unistd.h>
#endif
#include <ctype.h>
#ifdef __linux
#include <execinfo.h>
#endif
/* END specific definitions */
static void __cdecl htsshow_init(t_hts_callbackarg * carg);
@@ -833,6 +836,7 @@ static void sig_ask(int code) { // demander
}
}
#endif
static void sig_brpipe(int code) { // treat if necessary
signal(code, sig_brpipe);
}
@@ -870,6 +874,63 @@ static void sig_doback(int blind) { // mettre en backing
}
#endif
#undef FD_ERR
#define FD_ERR 2
static void print_backtrace(void) {
#ifdef __linux
void *stack[256];
const int size = backtrace(stack, sizeof(stack)/sizeof(stack[0]));
if (size != 0) {
backtrace_symbols_fd(stack, size, FD_ERR);
}
#else
const char msg[] = "No stack trace available on this OS :(\n";
write(FD_ERR, msg, sizeof(msg) - 1);
#endif
}
static size_t print_num(char *buffer, int num) {
size_t i, j;
if (num < 0) {
*(buffer++) = '-';
num = -num;
}
for(i = 0 ; num != 0 || i == 0 ; i++, num /= 10) {
buffer[i] = '0' + ( num % 10 );
}
for(j = 0 ; j < i ; j++) {
const char c = buffer[i - j - 1];
buffer[i - j - 1] = buffer[j];
buffer[j] = c;
}
buffer[i] = '\0';
return i;
}
static void sig_fatal(int code) {
const char msg[] = "\nCaught signal ";
const char msgreport[] =
"\nPlease report the problem at http://forum.httrack.com\n";
char buffer[256];
size_t size;
signal(code, SIG_DFL);
signal(SIGABRT, SIG_DFL);
memcpy(buffer, msg, sizeof(msg) - 1);
size = sizeof(msg) - 1;
size += print_num(&buffer[size], code);
buffer[size++] = '\n';
(void) (write(FD_ERR, buffer, size) == size);
print_backtrace();
(void) (write(FD_ERR, msgreport, sizeof(msgreport) - 1)
== sizeof(msgreport) - 1);
abort();
}
#undef FD_ERR
static void sig_leave(int code) {
if (global_opt != NULL && global_opt->state._hts_in_mirror) {
signal(code, sig_term); // quitter si encore
@@ -906,6 +967,21 @@ static void signal_handlers(void) {
signal(SIGPIPE, sig_brpipe); // broken pipe (write into non-opened socket)
signal(SIGCHLD, sig_ignore); // child change status
#endif
#ifdef SIGABRT
signal(SIGABRT, sig_fatal); // abort
#endif
#ifdef SIGBUS
signal(SIGBUS, sig_fatal); // bus error
#endif
#ifdef SIGILL
signal(SIGILL, sig_fatal); // illegal instruction
#endif
#ifdef SIGSEGV
signal(SIGSEGV, sig_fatal); // segmentation violation
#endif
#ifdef SIGSTKFLT
signal(SIGSTKFLT, sig_fatal); // stack fault
#endif
}
// fin routines de détournement de SIGHUP & co