This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU libtasn1".
http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=4b1805a021aa9abe74ba775aaaff84fc21ea07e9 The branch, master has been updated via 4b1805a021aa9abe74ba775aaaff84fc21ea07e9 (commit) from e9e074f518658c46dcc45c9305c7ff4f8eade302 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4b1805a021aa9abe74ba775aaaff84fc21ea07e9 Author: Simon Josefsson <si...@josefsson.org> Date: Tue Mar 13 23:47:28 2012 +0100 Add self-check. ----------------------------------------------------------------------- Summary of changes: NEWS | 1 + tests/Makefile.am | 4 ++-- tests/{Test_errors.c => Test_overflow.c} | 29 +++++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) copy tests/{Test_errors.c => Test_overflow.c} (62%) diff --git a/NEWS b/NEWS index a69be2c..188448d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ GNU Libtasn1 NEWS -*- outline -*- - Cleanup license headers. - build: Update gnulib files. - Corrected DER decoding issue (reported by Matthew Hall). + Added self check to detect the problem, see tests/Test_overflow.c. * Noteworthy changes in release 2.11 (2011-11-25) [stable] - qa: Now builds without compiler warnings with Solaris CC. diff --git a/tests/Makefile.am b/tests/Makefile.am index 9abc66d..61c8737 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,10 +34,10 @@ dist_check_SCRIPTS += threadsafety MOSTLYCLEANFILES = Test_parser_ERROR.asn check_PROGRAMS = Test_parser Test_tree Test_encoding Test_indefinite \ - Test_errors Test_simple + Test_errors Test_simple Test_overflow TESTS = Test_parser Test_tree Test_encoding Test_indefinite \ - Test_errors Test_simple crlf threadsafety + Test_errors Test_simple Test_overflow crlf threadsafety TESTS_ENVIRONMENT = \ ASN1PARSER=$(srcdir)/Test_parser.asn \ diff --git a/tests/Test_errors.c b/tests/Test_overflow.c similarity index 62% copy from tests/Test_errors.c copy to tests/Test_overflow.c index 2c85100..383f723 100644 --- a/tests/Test_errors.c +++ b/tests/Test_overflow.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 Free Software Foundation, Inc. + * Copyright (C) 2012 Free Software Foundation, Inc. * * This file is part of LIBTASN1. * @@ -18,21 +18,30 @@ * */ +/* Written by Simon Josefsson */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + #include "libtasn1.h" int -main (int argc, char *argv[]) +main (void) { - asn1_retCode ec = 0; - const char *errstr; + unsigned char der[] = "\x84\x7F\xFF\xFF\xFF"; + long l; + int len; + + l = asn1_get_length_der (der, sizeof der, &len); - do - { - errstr = asn1_strerror (ec); - asn1_perror (ec); - ec++; + if (l == -3L) + puts ("asn1_get_length_der rejected overflow OK"); + else + { + printf ("asn1_get_length_der overflow (l %lX len %X)\n", l, len); + return 1; } - while (errstr); return 0; } hooks/post-receive -- GNU libtasn1