Browse code

add check to detect certain compiler bugs that cause incorrect code generation for CLI_ISCONTAINED. So we avoid having bugs like #613, and #670 reported over and over.

git-svn: trunk@3234

Török Edvin authored on 2007/09/21 07:00:04
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Sep 21 00:13:32 EEST 2007(edwin)
2
+------------------------------------
3
+  * configure, configure.in: add check to detect certain compiler bugs that
4
+  cause incorrect code generation for CLI_ISCONTAINED.
5
+
1 6
 Thu Sep 20 23:19:20 EEST 2007(edwin)
2 7
 ------------------------------------
3 8
   * libclamav/phishcheck.c: improve url extraction algorithm.
... ...
@@ -1495,6 +1495,7 @@ Optional Features:
1495 1495
   --enable-fast-install[=PKGS]
1496 1496
                           optimize for fast installation [default=yes]
1497 1497
   --disable-libtool-lock  avoid locking (might break parallel builds)
1498
+  --disable-gcc-vcheck	  do not check for buggy gcc version
1498 1499
   --enable-experimental	enable experimental code
1499 1500
   --enable-maintainer-mode enable make rules and dependencies not useful
1500 1501
                           (and sometimes confusing) to the casual installer
... ...
@@ -19969,6 +19970,346 @@ _ACEOF
19969 19969
 fi
19970 19970
 
19971 19971
 
19972
+# Check whether --enable-gcc-vcheck was given.
19973
+if test "${enable_gcc_vcheck+set}" = set; then
19974
+  enableval=$enable_gcc_vcheck; gcc_check=$enableval
19975
+else
19976
+  gcc_check="yes"
19977
+fi
19978
+
19979
+
19980
+msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
19981
+
19982
+if test "$gcc_check" = "yes"; then
19983
+	if test "x$ac_compiler_gnu" = "xyes"; then
19984
+		{ echo "$as_me:$LINENO: checking for a supported version of gcc" >&5
19985
+echo $ECHO_N "checking for a supported version of gcc... $ECHO_C" >&6; }
19986
+		gcc_version=`${CC} -dumpversion`
19987
+		case "${gcc_version}" in
19988
+			4.1.0*)
19989
+				{ echo "$as_me:$LINENO: result: no (${gcc_version})" >&5
19990
+echo "${ECHO_T}no (${gcc_version})" >&6; }
19991
+				{ { echo "$as_me:$LINENO: error: gcc 4.1.0 is known to incorrectly compile upx.c. Upgrade your compiler to at least 4.1.1/4.1.2)" >&5
19992
+echo "$as_me: error: gcc 4.1.0 is known to incorrectly compile upx.c. Upgrade your compiler to at least 4.1.1/4.1.2)" >&2;}
19993
+   { (exit 1); exit 1; }; }
19994
+				;;
19995
+			*)
19996
+				{ echo "$as_me:$LINENO: result: ok (${gcc_version})" >&5
19997
+echo "${ECHO_T}ok (${gcc_version})" >&6; }
19998
+				;;
19999
+	esac
20000
+	fi
20001
+fi
20002
+
20003
+
20004
+{ echo "$as_me:$LINENO: checking for gcc bug PR27603" >&5
20005
+echo $ECHO_N "checking for gcc bug PR27603... $ECHO_C" >&6; }
20006
+if test "$cross_compiling" = yes; then
20007
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
20008
+See \`config.log' for more details." >&5
20009
+echo "$as_me: error: cannot run test program while cross compiling
20010
+See \`config.log' for more details." >&2;}
20011
+   { (exit 1); exit 1; }; }
20012
+else
20013
+  cat >conftest.$ac_ext <<_ACEOF
20014
+/* confdefs.h.  */
20015
+_ACEOF
20016
+cat confdefs.h >>conftest.$ac_ext
20017
+cat >>conftest.$ac_ext <<_ACEOF
20018
+/* end confdefs.h.  */
20019
+
20020
+void exit (int);
20021
+void abort (void);
20022
+int a;
20023
+int main()
20024
+{
20025
+  int j;
20026
+  for (j = 0; j < 6; j++)
20027
+  {
20028
+    if ((unsigned)j - 3 <= 1)
20029
+      exit (0);
20030
+    a = 1000 * (6 - j);
20031
+  }
20032
+  abort ();
20033
+}
20034
+
20035
+_ACEOF
20036
+rm -f conftest$ac_exeext
20037
+if { (ac_try="$ac_link"
20038
+case "(($ac_try" in
20039
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20040
+  *) ac_try_echo=$ac_try;;
20041
+esac
20042
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20043
+  (eval "$ac_link") 2>&5
20044
+  ac_status=$?
20045
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20046
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20047
+  { (case "(($ac_try" in
20048
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20049
+  *) ac_try_echo=$ac_try;;
20050
+esac
20051
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20052
+  (eval "$ac_try") 2>&5
20053
+  ac_status=$?
20054
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20055
+  (exit $ac_status); }; }; then
20056
+  { echo "$as_me:$LINENO: result: ok, bug not present" >&5
20057
+echo "${ECHO_T}ok, bug not present" >&6; }
20058
+else
20059
+  echo "$as_me: program exited with status $ac_status" >&5
20060
+echo "$as_me: failed program was:" >&5
20061
+sed 's/^/| /' conftest.$ac_ext >&5
20062
+
20063
+( exit $ac_status )
20064
+{ { echo "$as_me:$LINENO: error: your compiler has gcc PR27603 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27603" >&5
20065
+echo "$as_me: error: your compiler has gcc PR27603 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27603" >&2;}
20066
+   { (exit 1); exit 1; }; }
20067
+fi
20068
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20069
+fi
20070
+
20071
+
20072
+
20073
+{ echo "$as_me:$LINENO: checking for gcc bug PR28045" >&5
20074
+echo $ECHO_N "checking for gcc bug PR28045... $ECHO_C" >&6; }
20075
+if test "$cross_compiling" = yes; then
20076
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
20077
+See \`config.log' for more details." >&5
20078
+echo "$as_me: error: cannot run test program while cross compiling
20079
+See \`config.log' for more details." >&2;}
20080
+   { (exit 1); exit 1; }; }
20081
+else
20082
+  cat >conftest.$ac_ext <<_ACEOF
20083
+/* confdefs.h.  */
20084
+_ACEOF
20085
+cat confdefs.h >>conftest.$ac_ext
20086
+cat >>conftest.$ac_ext <<_ACEOF
20087
+/* end confdefs.h.  */
20088
+
20089
+extern void abort(void);
20090
+struct a
20091
+{
20092
+   unsigned int bits : 1;
20093
+   signed long val : ((sizeof(long) * 8) - 1);
20094
+};
20095
+int Fnegate (struct a b)
20096
+{
20097
+  if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
20098
+      && (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
20099
+     return 0 ;
20100
+  abort ();
20101
+}
20102
+int main ()
20103
+{
20104
+  struct a b = {1, 1};
20105
+  Fnegate (b);
20106
+  return 0;
20107
+}
20108
+
20109
+_ACEOF
20110
+rm -f conftest$ac_exeext
20111
+if { (ac_try="$ac_link"
20112
+case "(($ac_try" in
20113
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20114
+  *) ac_try_echo=$ac_try;;
20115
+esac
20116
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20117
+  (eval "$ac_link") 2>&5
20118
+  ac_status=$?
20119
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20120
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20121
+  { (case "(($ac_try" in
20122
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20123
+  *) ac_try_echo=$ac_try;;
20124
+esac
20125
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20126
+  (eval "$ac_try") 2>&5
20127
+  ac_status=$?
20128
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20129
+  (exit $ac_status); }; }; then
20130
+  { echo "$as_me:$LINENO: result: ok, bug not present" >&5
20131
+echo "${ECHO_T}ok, bug not present" >&6; }
20132
+else
20133
+  echo "$as_me: program exited with status $ac_status" >&5
20134
+echo "$as_me: failed program was:" >&5
20135
+sed 's/^/| /' conftest.$ac_ext >&5
20136
+
20137
+( exit $ac_status )
20138
+{ { echo "$as_me:$LINENO: error: your compiler has gcc PR28045 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28045" >&5
20139
+echo "$as_me: error: your compiler has gcc PR28045 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28045" >&2;}
20140
+   { (exit 1); exit 1; }; }
20141
+fi
20142
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20143
+fi
20144
+
20145
+
20146
+
20147
+{ echo "$as_me:$LINENO: checking for gcc bug PR26763-2" >&5
20148
+echo $ECHO_N "checking for gcc bug PR26763-2... $ECHO_C" >&6; }
20149
+if test "$cross_compiling" = yes; then
20150
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
20151
+See \`config.log' for more details." >&5
20152
+echo "$as_me: error: cannot run test program while cross compiling
20153
+See \`config.log' for more details." >&2;}
20154
+   { (exit 1); exit 1; }; }
20155
+else
20156
+  cat >conftest.$ac_ext <<_ACEOF
20157
+/* confdefs.h.  */
20158
+_ACEOF
20159
+cat confdefs.h >>conftest.$ac_ext
20160
+cat >>conftest.$ac_ext <<_ACEOF
20161
+/* end confdefs.h.  */
20162
+
20163
+extern void abort(void);
20164
+
20165
+int try (char *a, int d)
20166
+{
20167
+  return a + d > a;
20168
+}
20169
+
20170
+int main(void)
20171
+{
20172
+  char bla[100];
20173
+
20174
+  if (try (bla + 50, -1))
20175
+    abort ();
20176
+
20177
+  return 0;
20178
+}
20179
+
20180
+_ACEOF
20181
+rm -f conftest$ac_exeext
20182
+if { (ac_try="$ac_link"
20183
+case "(($ac_try" in
20184
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20185
+  *) ac_try_echo=$ac_try;;
20186
+esac
20187
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20188
+  (eval "$ac_link") 2>&5
20189
+  ac_status=$?
20190
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20191
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20192
+  { (case "(($ac_try" in
20193
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20194
+  *) ac_try_echo=$ac_try;;
20195
+esac
20196
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20197
+  (eval "$ac_try") 2>&5
20198
+  ac_status=$?
20199
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20200
+  (exit $ac_status); }; }; then
20201
+  { echo "$as_me:$LINENO: result: ok, bug not present" >&5
20202
+echo "${ECHO_T}ok, bug not present" >&6; }
20203
+else
20204
+  echo "$as_me: program exited with status $ac_status" >&5
20205
+echo "$as_me: failed program was:" >&5
20206
+sed 's/^/| /' conftest.$ac_ext >&5
20207
+
20208
+( exit $ac_status )
20209
+{ { echo "$as_me:$LINENO: error: your compiler has gcc PR26763-2 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26763" >&5
20210
+echo "$as_me: error: your compiler has gcc PR26763-2 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26763" >&2;}
20211
+   { (exit 1); exit 1; }; }
20212
+fi
20213
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20214
+fi
20215
+
20216
+
20217
+
20218
+{ echo "$as_me:$LINENO: checking for valid code generation of CLI_ISCONTAINED" >&5
20219
+echo $ECHO_N "checking for valid code generation of CLI_ISCONTAINED... $ECHO_C" >&6; }
20220
+if test "$cross_compiling" = yes; then
20221
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
20222
+See \`config.log' for more details." >&5
20223
+echo "$as_me: error: cannot run test program while cross compiling
20224
+See \`config.log' for more details." >&2;}
20225
+   { (exit 1); exit 1; }; }
20226
+else
20227
+  cat >conftest.$ac_ext <<_ACEOF
20228
+/* confdefs.h.  */
20229
+_ACEOF
20230
+cat confdefs.h >>conftest.$ac_ext
20231
+cat >>conftest.$ac_ext <<_ACEOF
20232
+/* end confdefs.h.  */
20233
+
20234
+#include <stdint.h>
20235
+#include <stdio.h>
20236
+static struct v{
20237
+	char* dst;
20238
+	uint32_t dsize;
20239
+	uint32_t dcur;
20240
+	uint32_t backsize;
20241
+ 	int32_t unp_offset;
20242
+} values[] = {
20243
+	{(char*)0xf78ab008, 0x2e000, 1, 4, 0xfffff9f3},
20244
+	{(char*)0xb7af1008, 0x2e000, 1, 4, 0xfffff9f3}
20245
+
20246
+};
20247
+extern void abort(void);
20248
+
20249
+#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size)	\
20250
+    (bb_size > 0 && sb_size > 0 && sb_size <= bb_size	\
20251
+     && sb >= bb && sb + sb_size <= bb + bb_size && sb + sb_size > bb)
20252
+
20253
+int main()
20254
+{
20255
+	int i;
20256
+	for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
20257
+		struct v* v= &values[i];
20258
+		char* dst = v->dst;
20259
+		uint32_t* dsize = &v->dsize;
20260
+		uint32_t dcur = v->dcur;
20261
+		uint32_t backsize = v->backsize-1;
20262
+		int32_t  unp_offset = v->unp_offset;
20263
+
20264
+		if(!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) ||
20265
+				!CLI_ISCONTAINED(dst, *dsize,dst+dcur,backsize) || unp_offset >= 0)  {
20266
+			continue;
20267
+		}
20268
+		abort();
20269
+	}
20270
+	return 0;
20271
+}
20272
+
20273
+_ACEOF
20274
+rm -f conftest$ac_exeext
20275
+if { (ac_try="$ac_link"
20276
+case "(($ac_try" in
20277
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20278
+  *) ac_try_echo=$ac_try;;
20279
+esac
20280
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20281
+  (eval "$ac_link") 2>&5
20282
+  ac_status=$?
20283
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20284
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20285
+  { (case "(($ac_try" in
20286
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20287
+  *) ac_try_echo=$ac_try;;
20288
+esac
20289
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20290
+  (eval "$ac_try") 2>&5
20291
+  ac_status=$?
20292
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
20293
+  (exit $ac_status); }; }; then
20294
+  { echo "$as_me:$LINENO: result: ok, bug not present" >&5
20295
+echo "${ECHO_T}ok, bug not present" >&6; }
20296
+else
20297
+  echo "$as_me: program exited with status $ac_status" >&5
20298
+echo "$as_me: failed program was:" >&5
20299
+sed 's/^/| /' conftest.$ac_ext >&5
20300
+
20301
+( exit $ac_status )
20302
+{ { echo "$as_me:$LINENO: error: your compiler has a bug that causes clamav 670, use a different compiler, see http://bugs.clamav.net/bugzilla/show_bug.cgi?id=670" >&5
20303
+echo "$as_me: error: your compiler has a bug that causes clamav 670, use a different compiler, see http://bugs.clamav.net/bugzilla/show_bug.cgi?id=670" >&2;}
20304
+   { (exit 1); exit 1; }; }
20305
+fi
20306
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20307
+fi
20308
+
20309
+
20310
+
20311
+
19972 20312
 
19973 20313
 
19974 20314
 
... ...
@@ -40,6 +40,149 @@ AC_DEFINE(SCANBUFF, 131072, [scan buffer size])
40 40
 AC_DEFINE(FILEBUFF, 8192,   [file i/o buffer size])
41 41
 
42 42
 AC_HEADER_STDC
43
+
44
+AC_ARG_ENABLE(gcc-vcheck,
45
+[  --disable-gcc-vcheck	  do not check for buggy gcc version ],
46
+gcc_check=$enableval, gcc_check="yes")
47
+
48
+msg_gcc_check="use --disable-gcc-vcheck to disable this check. Before reporting any bugs check with a supported version of gcc"
49
+
50
+dnl Check for gcc-4.1.0
51
+if test "$gcc_check" = "yes"; then
52
+	if test "x$ac_compiler_gnu" = "xyes"; then
53
+		AC_MSG_CHECKING([for a supported version of gcc])
54
+		gcc_version=`${CC} -dumpversion`
55
+		case "${gcc_version}" in
56
+			4.1.0*)
57
+				AC_MSG_RESULT([no (${gcc_version})])
58
+				AC_MSG_ERROR([gcc 4.1.0 is known to incorrectly compile upx.c. Upgrade your compiler to at least 4.1.1/4.1.2)])
59
+				;;
60
+			*)
61
+				AC_MSG_RESULT([ok (${gcc_version})])
62
+				;;
63
+	esac
64
+	fi
65
+fi
66
+
67
+dnl Checks if compiler produces valid code, regardless of compiler
68
+dnl we do these checks here to avoid receiving endless bugreports about
69
+dnl breakages due to compiler bugs.
70
+
71
+dnl Check if compiler produces invalid code on gcc PR27603 (affects upx.c)
72
+AC_MSG_CHECKING([for gcc bug PR27603])
73
+AC_TRY_RUN(
74
+	   [
75
+void exit (int);
76
+void abort (void);
77
+int a;
78
+int main()
79
+{
80
+  int j;
81
+  for (j = 0; j < 6; j++)
82
+  {
83
+    if ((unsigned)j - 3 <= 1)
84
+      exit (0);
85
+    a = 1000 * (6 - j);
86
+  }
87
+  abort ();
88
+}
89
+], [AC_MSG_RESULT([ok, bug not present])],
90
+[AC_MSG_ERROR([your compiler has gcc PR27603 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27603])])
91
+
92
+dnl Check if compiler produces invalid code on gcc PR28045 (affects upx.c)
93
+AC_MSG_CHECKING([for gcc bug PR28045])
94
+AC_TRY_RUN(
95
+	   [
96
+extern void abort(void);
97
+struct a
98
+{
99
+   unsigned int bits : 1;
100
+   signed long val : ((sizeof(long) * 8) - 1);
101
+};
102
+int Fnegate (struct a b)
103
+{
104
+  if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))
105
+      && (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1))
106
+     return 0 ;
107
+  abort ();
108
+}
109
+int main ()
110
+{
111
+  struct a b = {1, 1};
112
+  Fnegate (b);
113
+  return 0;
114
+}
115
+], [AC_MSG_RESULT([ok, bug not present])],
116
+[AC_MSG_ERROR([your compiler has gcc PR28045 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28045])])
117
+
118
+dnl Check if compiler produces invalid code on gcc PR26763-2 (affects upx.c)
119
+AC_MSG_CHECKING([for gcc bug PR26763-2])
120
+AC_TRY_RUN(
121
+	   [
122
+extern void abort(void);
123
+
124
+int try (char *a, int d)
125
+{
126
+  return a + d > a;
127
+}
128
+
129
+int main(void)
130
+{
131
+  char bla[100];
132
+
133
+  if (try (bla + 50, -1))
134
+    abort ();
135
+
136
+  return 0;
137
+}
138
+], [AC_MSG_RESULT([ok, bug not present])],
139
+[AC_MSG_ERROR([your compiler has gcc PR26763-2 bug, use a different compiler, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26763])])
140
+
141
+dnl Check if compiler produces invalid code on own testcase based on upx.c
142
+AC_MSG_CHECKING([for valid code generation of CLI_ISCONTAINED])
143
+AC_TRY_RUN(
144
+	   [
145
+#include <stdint.h>
146
+#include <stdio.h>
147
+static struct v{
148
+	char* dst;
149
+	uint32_t dsize;
150
+	uint32_t dcur;
151
+	uint32_t backsize;
152
+ 	int32_t unp_offset;
153
+} values[] = {
154
+	{(char*)0xf78ab008, 0x2e000, 1, 4, 0xfffff9f3},
155
+	{(char*)0xb7af1008, 0x2e000, 1, 4, 0xfffff9f3}
156
+
157
+};
158
+extern void abort(void);
159
+
160
+#define CLI_ISCONTAINED(bb, bb_size, sb, sb_size)	\
161
+    (bb_size > 0 && sb_size > 0 && sb_size <= bb_size	\
162
+     && sb >= bb && sb + sb_size <= bb + bb_size && sb + sb_size > bb)
163
+
164
+int main()
165
+{
166
+	int i;
167
+	for(i=0;i<sizeof(values)/sizeof(values[0]);i++) {
168
+		struct v* v= &values[i];
169
+		char* dst = v->dst;
170
+		uint32_t* dsize = &v->dsize;
171
+		uint32_t dcur = v->dcur;
172
+		uint32_t backsize = v->backsize-1;
173
+		int32_t  unp_offset = v->unp_offset;
174
+
175
+		if(!CLI_ISCONTAINED(dst, *dsize, dst+dcur+unp_offset, backsize) ||
176
+				!CLI_ISCONTAINED(dst, *dsize,dst+dcur,backsize) || unp_offset >= 0)  {
177
+			continue;
178
+		}
179
+		abort();
180
+	}
181
+	return 0;
182
+}
183
+], [AC_MSG_RESULT([ok, bug not present])],
184
+[AC_MSG_ERROR([your compiler has a bug that causes clamav 670, use a different compiler, see http://bugs.clamav.net/bugzilla/show_bug.cgi?id=670])])
185
+
43 186
 AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h iconv.h stdbool.h pwd.h grp.h)
44 187
 AC_CHECK_HEADER(syslog.h,AC_DEFINE(USE_SYSLOG,1,[use syslog]),)
45 188