Branden Archer [Thu, 26 May 2016 03:15:17 +0000 (23:15 -0400)]
Add test case where %n is passed into a ck_assert call
In the past it was possible to cause issues if arguments
were passed into ck_assert* macros which included %n.
Exist unit tests check for output format options, such as
%d and %f. No test existed for %n, which writes a value to
memory if used.
Ulrich Eckhardt observed that passing something with a %n in it
would result in issues running Check 0.9.10. Although the
issue is already resolved, this commit adds the test case mentioned in
Ulrich's GitHub issue: https://github.com/libcheck/check/issues/41
the ltmain.sh script, generated by libtoolize, does not seem to honor the AC_CONFIG_AUX_DIR parameter. As a
result, the configure script will fail. To work around this, remove the AC_CONFIG_AUX_DIR option
to place all generated scripts into the current directory.
This is half an issue report and half a pull request.
The reason for this is that while autoreconf -fi works for most of the
needed scripts it doesn't copy ltmain.sh into build-aux which results
the following ./configure failure:
configure.ac:137: error: required file 'build-aux/ltmain.sh' not found
This patch, which is a similar one I've provided to cloog[0] which
allows ./configure to at least complete.
I'm not sure what you think since obviously the directory was used for
some reason, likely to reduce top-level directory clutter, but this at
least works for me.
Joshua D. Boyd [Tue, 22 Mar 2016 04:50:34 +0000 (00:50 -0400)]
In cmake build, use mkstemp when present
This fixes this error, seen when building with cmake:
check/src/check_msg.c:247: warning: the use of 'tempnam' is dangerous, better use `mkstemp'
CMakeLists.txt checks for mkstemp being present and sents a cmake
variable HAVE_MKSTEMP. The check_msg.c file will use mkstemp if
HAVE_MKSTEMP is true, but the cmake variable wasn't causing HAVE_MKSTEMP
to be defined for the C compiler.
lib/strsignal.c: strsignal() should be not be declared const
POSIX requires strsignal() to return a pointer to a char, not a pointer
to a const char. [1] On uClibc, and possibly other libcs, this causes
problems with the correct declaration in string.h.
[1] man 3 strsignal
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Jan Pokorný [Tue, 1 Mar 2016 17:41:58 +0000 (18:41 +0100)]
Fix segfault when memmoving with negative/enormous n
I observed a segmentation fault caused by trying to memmove by -15,
which makes 18446744073709551601 on my 64-bit platform after an argument
type promotion (from int into size_t). In my case, this was connected
with filling up disk during the test facilitated by check, hence I derive
that the main issue was that not enough bytes for particular type of
message was actually read (and previously written, for that matter) and
because of this incompleteness, get_result happily consumed more bytes
than was read.
Additional debugging info at the point of segfault (src/check_pack.c):
> 468│ /* Move remaining data in buffer to the beginning */
> 469├> memmove(buf, buf + n, nparse);
> 470│ /* If EOF has not been seen */
> 471│ if(nread > 0)
>
> (gdb) p nparse
> $1 = -15
> (gdb) p n
> $2 = 23
> (gdb) p nread
> $3 = 0
Georg Sauthoff [Tue, 29 Dec 2015 17:10:52 +0000 (18:10 +0100)]
Use only POSIX conforming features of printf
This fixes 3 test failures on Solaris 10.
POSIX standardized printf, but the hex style \xHH sequences
aren't included in the standard. POSIX printf does understand
octal style \NNN sequences, though.
This should also work with shells where printf is a builtin (e.g.
on Lubuntu which probably uses dash).
Tested with xpg4-sh on Solaris 10 and bash/zsh/dash on Linux.
brarcher [Wed, 23 Dec 2015 16:59:04 +0000 (16:59 +0000)]
checkmk: use double slash in regular expression
For many awk implementations using both a single and double slash
escapes in regex expressions in strings works correctly. However,
it was observed on Solaris that a single slash results in the
literal value being added to the string (e.g. \n was a newline)
and only the double slash works as expected.
As there should be no harm, updating the regex expressions to use
double slashes.
Previously output XML files could contain illegal characters.
Some of these characters could be encoded, and others should
not be output at all.
This change will attempt to encode characters if they are not
printable or are special. Note that if a test contains a UTF-8
charater it will not be printed out accurately.
In order to get the tests for encoding XML characters to work,
the characters separating fields in a shell variable needed to
be changed. Originally white space would separate fields,
meaning shell would eat the extra whitespace in the tests.
Because of the change, the xml output test needed to be
reworked to not rely on white space field separators.
Additionally, the printf program is used to properly un-escape
strings used in the tests.
brarcher [Sun, 2 Aug 2015 16:59:36 +0000 (16:59 +0000)]
configure: Remove duplicated use of AC_USE_SYSTEM_EXTENSIONS
Either the first or the second one is redundant so one should be
removed but beware, there's a bug introduced in automake 1.14
(fixed in 1.15) that would potentially cause trouble if you put it
before AM_INIT_AUTOMAKE.
More info about this automake bug here:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15981
This header is necessary one some platforms where some portions
of check.h are unrecognized. For example, using the MSVC compiler
on Windows the pid_t usage in check.h results in a compiler error.
brarcher [Sun, 14 Jun 2015 16:07:03 +0000 (16:07 +0000)]
configure: fix check micro version
This was not updated during the last release. Although it is technically
still out of date (as this is now check 0.9.14+), it is at least
a little more correct.