From MAILER-DAEMON Wed Mar 07 04:28:30 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S5DAc-0005TA-U7
	for mharc-libtasn1-commit@gnu.org; Wed, 07 Mar 2012 04:28:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:47446)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S5DAV-0005Sw-UC
	for libtasn1-commit@gnu.org; Wed, 07 Mar 2012 04:28:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S5DA9-0001bK-FG
	for libtasn1-commit@gnu.org; Wed, 07 Mar 2012 04:28:23 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37236)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S5DA9-0001bC-B3
	for libtasn1-commit@gnu.org; Wed, 07 Mar 2012 04:28:01 -0500
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S5DA8-00010V-Eo
	for libtasn1-commit@gnu.org; Wed, 07 Mar 2012 09:28:00 +0000
Date: Wed, 07 Mar 2012 09:28:00 +0000
Message-Id: <E1S5DA8-00010V-Eo@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-8-g2259a29
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3332d9cab1e9ab8b6c991c7ff0f4a2bda1ea7544
X-Git-Newrev: 2259a29c5ae7c34c7709235c96f47a069c2394bb
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Mar 2012 09:28:30 -0000

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=2259a29c5ae7c34c7709235c96f47a069c2394bb

The branch, master has been updated
       via  2259a29c5ae7c34c7709235c96f47a069c2394bb (commit)
      from  3332d9cab1e9ab8b6c991c7ff0f4a2bda1ea7544 (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 2259a29c5ae7c34c7709235c96f47a069c2394bb
Author: Simon Josefsson <simon@josefsson.org>
Date:   Wed Mar 7 10:26:44 2012 +0100

    Update gnulib files.

-----------------------------------------------------------------------

Summary of changes:
 GNUmakefile                |   14 +-------
 NEWS                       |    1 +
 build-aux/update-copyright |   13 ++++++--
 gl/errno.in.h              |    3 +-
 gl/gettext.h               |    3 +-
 gl/lseek.c                 |    3 +-
 gl/malloc.c                |    3 +-
 gl/msvc-inval.c            |    3 +-
 gl/msvc-inval.h            |    3 +-
 gl/msvc-nothrow.c          |    3 +-
 gl/msvc-nothrow.h          |    3 +-
 gl/read-file.c             |    3 +-
 gl/read-file.h             |    3 +-
 gl/stdarg.in.h             |    3 +-
 gl/stddef.in.h             |    3 +-
 gl/stdint.in.h             |   11 ++++---
 gl/stdio-impl.h            |    2 +
 gl/stdio.in.h              |    5 +--
 gl/sys_stat.in.h           |   30 +++++++++++++++----
 gl/time.in.h               |    3 +-
 gl/unistd.in.h             |    3 +-
 gl/version-etc.h           |    2 +-
 lib/gllib/stddef.in.h      |    3 +-
 lib/gllib/stdint.in.h      |   11 ++++---
 lib/gllib/string.in.h      |    3 +-
 lib/gllib/strverscmp.c     |    3 +-
 maint.mk                   |   69 ++++++++++++++++++++++++++++---------------
 27 files changed, 116 insertions(+), 93 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index d0fd3e8..58f2ead 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -20,20 +20,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Systems where /bin/sh is not the default shell need this.  The $(shell)
-# command below won't work with e.g. stock DOS/Windows shells.
-ifeq ($(wildcard /bin/s[h]),/bin/sh)
-SHELL = /bin/sh
-else
-# will be used only with the next shell-test line, then overwritten
-# by a configured-in value
-SHELL = sh
-endif
-
 # If the user runs GNU make but has not yet run ./configure,
 # give them a diagnostic.
-_have-Makefile := $(shell test -f Makefile && echo yes)
-ifeq ($(_have-Makefile),yes)
+_gl-Makefile := $(wildcard [M]akefile)
+ifneq ($(_gl-Makefile),)
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
diff --git a/NEWS b/NEWS
index ea6f001..c3b49fa 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 GNU Libtasn1 NEWS                                     -*- outline -*-
 
 * Noteworthy changes in release 2.12 (????-??-??) [?]
+- build: Update gnulib files.
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]
 - qa: Now builds without compiler warnings with Solaris CC.
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index d86a12b..082b749 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
     if 0;
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2011-01-02.20:59'; # UTC
+my $VERSION = '2012-02-05.21:39'; # UTC
 
 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
@@ -24,7 +24,7 @@ my $VERSION = '2011-01-02.20:59'; # UTC
 
 # The arguments to this script should be names of files that contain
 # copyright statements to be updated.  The copyright holder's name
-# defaults to "Free Softward Foundation, Inc." but may be changed to
+# defaults to "Free Software Foundation, Inc." but may be changed to
 # any other name by using the "UPDATE_COPYRIGHT_HOLDER" environment
 # variable.
 #
@@ -43,7 +43,7 @@ my $VERSION = '2011-01-02.20:59'; # UTC
 # A warning is printed for every file for which no copyright
 # statement is recognized.
 #
-# Each file's copyright statement must be formated correctly in
+# Each file's copyright statement must be formatted correctly in
 # order to be recognized.  For example, each of these is fine:
 #
 #   Copyright @copyright{} 1990-2005, 2007-2009 Free Software
@@ -110,6 +110,9 @@ my $VERSION = '2011-01-02.20:59'; # UTC
 #      interval (such as 1990-2008).  If unset or set to 0, all existing
 #      copyright year intervals in a reformatted FSF copyright statement
 #      are expanded instead.
+#      If UPDATE_COPYRIGHT_USE_INTERVALS=2, convert a sequence with gaps
+#      to the minimal containing range.  For example, convert
+#      2000, 2004-2007, 2009 to 2000-2009.
 #   3. For testing purposes, you can set the assumed current year in
 #      UPDATE_COPYRIGHT_YEAR.
 #   4. The default maximum line length for a copyright line is 72.
@@ -221,6 +224,10 @@ if (defined $stmt_re)
                   }))
                 )+
               /$1-$3/gx;
+
+            # When it's 2, emit a single range encompassing all year numbers.
+            $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
+              and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
           }
 
         # Format within margin.
diff --git a/gl/errno.in.h b/gl/errno.in.h
index 5271bcd..2f42612 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _@GUARD_PREFIX@_ERRNO_H
 
diff --git a/gl/gettext.h b/gl/gettext.h
index 050134a..75875cd 100644
--- a/gl/gettext.h
+++ b/gl/gettext.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBGETTEXT_H
 #define _LIBGETTEXT_H 1
diff --git a/gl/lseek.c b/gl/lseek.c
index 5433678..cd7e2d6 100644
--- a/gl/lseek.c
+++ b/gl/lseek.c
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/malloc.c b/gl/malloc.c
index ffe042b..e0d5c89 100644
--- a/gl/malloc.c
+++ b/gl/malloc.c
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* written by Jim Meyering and Bruno Haible */
 
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c
index b7a917d..ba76a7e 100644
--- a/gl/msvc-inval.c
+++ b/gl/msvc-inval.c
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/msvc-inval.h b/gl/msvc-inval.h
index 373f9bf..eb6930b 100644
--- a/gl/msvc-inval.h
+++ b/gl/msvc-inval.h
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_INVAL_H
 #define _MSVC_INVAL_H
diff --git a/gl/msvc-nothrow.c b/gl/msvc-nothrow.c
index f0fea17..e5cf181 100644
--- a/gl/msvc-nothrow.c
+++ b/gl/msvc-nothrow.c
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/msvc-nothrow.h b/gl/msvc-nothrow.h
index e066b24..2b71945 100644
--- a/gl/msvc-nothrow.h
+++ b/gl/msvc-nothrow.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MSVC_NOTHROW_H
 #define _MSVC_NOTHROW_H
diff --git a/gl/read-file.c b/gl/read-file.c
index 72ab4e8..0d5ab8b 100644
--- a/gl/read-file.c
+++ b/gl/read-file.c
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
diff --git a/gl/read-file.h b/gl/read-file.h
index b45b76d..a1142b8 100644
--- a/gl/read-file.h
+++ b/gl/read-file.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef READ_FILE_H
 #define READ_FILE_H
diff --git a/gl/stdarg.in.h b/gl/stdarg.in.h
index 3e0e43f..53104a6 100644
--- a/gl/stdarg.in.h
+++ b/gl/stdarg.in.h
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _@GUARD_PREFIX@_STDARG_H
 
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index 65e1775..17fcaea 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index f16a2d4..8e4c822 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
@@ -36,8 +35,10 @@
 
 /* On Android (Bionic libc), <sys/types.h> includes this file before
    having defined 'time_t'.  Therefore in this case avoid including
-   other system header files; just include the system's <stdint.h>.  */
-#if defined __BIONIC__ \
+   other system header files; just include the system's <stdint.h>.
+   Ideally we should test __BIONIC__ here, but it is only defined after
+   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
+#if defined __ANDROID__ \
     && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #else
@@ -614,5 +615,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #endif
 
 #endif /* _@GUARD_PREFIX@_STDINT_H */
-#endif /* !(defined __BIONIC__ && ...) */
+#endif /* !(defined __ANDROID__ && ...) */
 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index a065c1a..4935795 100644
--- a/gl/stdio-impl.h
+++ b/gl/stdio-impl.h
@@ -26,6 +26,8 @@
 # include <sys/param.h>
 #endif
 
+#include <errno.h>                             /* For detecting Plan9.  */
+
 #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
 
 # if defined __DragonFly__          /* DragonFly */
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 0481930..9dc7c4a 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -779,7 +778,7 @@ _GL_CXXALIASWARN (pclose);
 #elif defined GNULIB_POSIXCHECK
 # undef pclose
 # if HAVE_RAW_DECL_PCLOSE
-_GL_WARN_ON_USE (pclose, "popen is unportable - "
+_GL_WARN_ON_USE (pclose, "pclose is unportable - "
                  "use gnulib module pclose for more portability");
 # endif
 #endif
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index 44b6a1b..e4331c7 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
 
@@ -616,14 +615,33 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 /* We can't use the object-like #define stat rpl_stat, because of
    struct stat.  This means that rpl_stat will not be used if the user
    does (stat)(a,b).  Oh well.  */
-#  undef stat
-#  ifdef _LARGE_FILES
+#  if defined _AIX && defined stat && defined _LARGE_FILES
     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
        so we have to replace stat64() instead of stat(). */
-#   define stat stat64
 #   undef stat64
 #   define stat64(name, st) rpl_stat (name, st)
-#  else /* !_LARGE_FILES */
+#  elif defined __MINGW32__ && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32i64.  */
+#    undef _stat32i64
+#    define _stat32i64(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64.  */
+#    undef _stat64
+#    define _stat64(name, st) rpl_stat (name, st)
+#   endif
+#  elif defined _MSC_VER && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32.  */
+#    undef _stat32
+#    define _stat32(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64i32.  */
+#    undef _stat64i32
+#    define _stat64i32(name, st) rpl_stat (name, st)
+#   endif
+#  else /* !(_AIX ||__MINGW32__ ||  _MSC_VER) */
+#   undef stat
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
diff --git a/gl/time.in.h b/gl/time.in.h
index 5080d45..04cde05 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 660094a..1b26c09 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
diff --git a/gl/version-etc.h b/gl/version-etc.h
index c62704c..5548c02 100644
--- a/gl/version-etc.h
+++ b/gl/version-etc.h
@@ -37,7 +37,7 @@ extern const char version_etc_copyright[];
    standard way: command and package names, package version, followed
    by a short GPLv3+ notice and a list of up to 10 author names.
 
-   If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
+   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
    the program.  The formats are therefore:
 
    PACKAGE VERSION
diff --git a/lib/gllib/stddef.in.h b/lib/gllib/stddef.in.h
index d282610..9384cf6 100644
--- a/lib/gllib/stddef.in.h
+++ b/lib/gllib/stddef.in.h
@@ -13,8 +13,7 @@
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
diff --git a/lib/gllib/stdint.in.h b/lib/gllib/stdint.in.h
index ea0f32f..de38072 100644
--- a/lib/gllib/stdint.in.h
+++ b/lib/gllib/stdint.in.h
@@ -13,8 +13,7 @@
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
@@ -36,8 +35,10 @@
 
 /* On Android (Bionic libc), <sys/types.h> includes this file before
    having defined 'time_t'.  Therefore in this case avoid including
-   other system header files; just include the system's <stdint.h>.  */
-#if defined __BIONIC__ \
+   other system header files; just include the system's <stdint.h>.
+   Ideally we should test __BIONIC__ here, but it is only defined after
+   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
+#if defined __ANDROID__ \
     && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #else
@@ -614,5 +615,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #endif
 
 #endif /* _@GUARD_PREFIX@_STDINT_H */
-#endif /* !(defined __BIONIC__ && ...) */
+#endif /* !(defined __ANDROID__ && ...) */
 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/lib/gllib/string.in.h b/lib/gllib/string.in.h
index 2b84c54..26652d3 100644
--- a/lib/gllib/string.in.h
+++ b/lib/gllib/string.in.h
@@ -13,8 +13,7 @@
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _@GUARD_PREFIX@_STRING_H
 
diff --git a/lib/gllib/strverscmp.c b/lib/gllib/strverscmp.c
index 5456519..46f3ebc 100644
--- a/lib/gllib/strverscmp.c
+++ b/lib/gllib/strverscmp.c
@@ -15,8 +15,7 @@
    GNU Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if !_LIBC
 # include <config.h>
diff --git a/maint.mk b/maint.mk
index 2668655..a97e0bd 100644
--- a/maint.mk
+++ b/maint.mk
@@ -178,6 +178,13 @@ syntax-check: $(local-check)
 #     Regular expression (ERE) denoting either a forbidden construct
 #     or a required construct.  Those arguments are exclusive.
 #
+#  exclude
+#
+#     Regular expression (ERE) denoting lines to ignore that matched
+#     a prohibit construct.  For example, this can be used to exclude
+#     comments that mention why the nearby code uses an alternative
+#     construct instead of the simpler prohibited construct.
+#
 #  in_vc_files | in_files
 #
 #     grep-E-style regexp denoting the files to check.  If no files
@@ -212,6 +219,17 @@ syntax-check: $(local-check)
 # when filtering by name via in_files, we explicitly filter out matching
 # names here as well.
 
+# Initialize each, so that envvar settings cannot interfere.
+export require =
+export prohibit =
+export exclude =
+export in_vc_files =
+export in_files =
+export containing =
+export non_containing =
+export halt =
+export with_grep_options =
+
 # By default, _sc_search_regexp does not ignore case.
 export ignore_case =
 _ignore_case = $$(test -n "$$ignore_case" && printf %s -i || :)
@@ -231,6 +249,9 @@ define _sc_search_regexp
    test -z "$$prohibit" && test -z "$$require"				\
      && { msg='Should specify either prohibit or require'		\
           $(_sc_say_and_exit) } || :;					\
+   test -z "$$prohibit" && test -n "$$exclude"				\
+     && { msg='Use of exclude requires a prohibit pattern'		\
+          $(_sc_say_and_exit) } || :;					\
    test -n "$$in_vc_files" && test -n "$$in_files"			\
      && { msg='Cannot specify both in_vc_files and in_files'		\
           $(_sc_say_and_exit) } || :;					\
@@ -258,6 +279,7 @@ define _sc_search_regexp
    if test -n "$$files"; then						\
      if test -n "$$prohibit"; then					\
        grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \
+         | grep -vE "$${exclude-^$$}"					\
          && { msg="$$halt" $(_sc_say_and_exit) } || :;			\
      else								\
        grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \
@@ -276,17 +298,17 @@ sc_avoid_if_before_free:
 	    exit 1; } || :
 
 sc_cast_of_argument_to_free:
-	@prohibit='\<free *\( *\(' halt='don'\''t cast free argument'	\
+	@prohibit='\<free *\( *\(' halt="don't cast free argument"	\
 	  $(_sc_search_regexp)
 
 sc_cast_of_x_alloc_return_value:
 	@prohibit='\*\) *x(m|c|re)alloc\>'				\
-	halt='don'\''t cast x*alloc return value'			\
+	halt="don't cast x*alloc return value"				\
 	  $(_sc_search_regexp)
 
 sc_cast_of_alloca_return_value:
 	@prohibit='\*\) *alloca\>'					\
-	halt='don'\''t cast alloca return value'			\
+	halt="don't cast alloca return value"				\
 	  $(_sc_search_regexp)
 
 sc_space_tab:
@@ -303,12 +325,12 @@ sc_prohibit_atoi_atof:
 	  $(_sc_search_regexp)
 
 # Use STREQ rather than comparing strcmp == 0, or != 0.
+sp_ = strcmp *\(.+\)
 sc_prohibit_strcmp:
-	@grep -nE '! *str''cmp *\(|\<str''cmp *\(.+\) *[!=]='	\
-	    $$($(VC_LIST_EXCEPT))					\
-	  | grep -vE ':# *define STRN?EQ\(' &&				\
-	  { echo '$(ME): replace str''cmp calls above with STREQ/STRNEQ' \
-		1>&2; exit 1; } || :
+	@prohibit='! *strcmp *\(|\<$(sp_) *[!=]=|[!=]= *$(sp_)'		\
+	exclude=':# *define STRN?EQ\('					\
+	halt='$(ME): replace strcmp calls above with STREQ/STRNEQ'	\
+	  $(_sc_search_regexp)
 
 # Pass EXIT_*, not number, to usage, exit, and error (when exiting)
 # Convert all uses automatically, via these two commands:
@@ -516,7 +538,7 @@ sc_prohibit_argmatch_without_use:
 
 sc_prohibit_canonicalize_without_use:
 	@h='canonicalize.h' \
-	re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode)' \
+	re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode|file_name)' \
 	  $(_sc_header_without_use)
 
 sc_prohibit_root_dev_ino_without_use:
@@ -708,12 +730,10 @@ _gl_translatable_diag_func_re ?= error
 # Look for diagnostics that aren't marked for translation.
 # This won't find any for which error's format string is on a separate line.
 sc_unmarked_diagnostics:
-	@grep -nE							\
-	    '\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \
-		$$($(VC_LIST_EXCEPT))					\
-	  | grep -Ev '(_|ngettext ?)\(' &&				\
-	  { echo '$(ME): found unmarked diagnostic(s)' 1>&2;		\
-	    exit 1; } || :
+	@prohibit='\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \
+	exclude='(_|ngettext ?)\('					\
+	halt='$(ME): found unmarked diagnostic(s)'			\
+	  $(_sc_search_regexp)
 
 # Avoid useless parentheses like those in this example:
 # #if defined (SYMBOL) || defined (SYM2)
@@ -974,10 +994,10 @@ sc_redundant_const:
 	  $(_sc_search_regexp)
 
 sc_const_long_option:
-	@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT))		\
-	  | grep -Ev 'const struct option|struct option const' && {	\
-	      echo 1>&2 '$(ME): add "const" to the above declarations'; \
-	      exit 1; } || :
+	@prohibit='^ *static.*struct option '				\
+	exclude='const struct option|struct option const'		\
+	halt='$(ME): add "const" to the above declarations'		\
+	  $(_sc_search_regexp)
 
 NEWS_hash =								\
   $$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p'		\
@@ -1015,8 +1035,8 @@ update-NEWS-hash: NEWS
 # setting this to ' && !/PRAGMA_SYSTEM_HEADER/'.
 _makefile_at_at_check_exceptions ?=
 sc_makefile_at_at_check:
-	@perl -ne '/\@[A-Z_0-9]+\@/'					\
-          -e ' && !/([A-Z_0-9]+)\s+=.*\@\1\@$$/'			\
+	@perl -ne '/\@\w+\@/'						\
+          -e ' && !/(\w+)\s+=.*\@\1\@$$/'				\
           -e ''$(_makefile_at_at_check_exceptions)			\
 	  -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'	\
 	    $$($(VC_LIST_EXCEPT) | grep -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
@@ -1079,7 +1099,7 @@ sc_po_check:
 # Sometimes it is useful to change the PATH environment variable
 # in Makefiles.  When doing so, it's better not to use the Unix-centric
 # path separator of ':', but rather the automake-provided '$(PATH_SEPARATOR)'.
-msg = '$(ME): Do not use '\'':'\'' above; use $$(PATH_SEPARATOR) instead'
+msg = '$(ME): Do not use ":" above; use $$(PATH_SEPARATOR) instead'
 sc_makefile_path_separator_check:
 	@prohibit='PATH[=].*:'						\
 	in_vc_files='akefile|\.mk$$'					\
@@ -1234,7 +1254,8 @@ announcement: NEWS ChangeLog $(rel-files)
 	    --gpg-key-id=$(gpg_key_ID)					\
 	    --news=$(srcdir)/NEWS					\
 	    --bootstrap-tools=$(bootstrap-tools)			\
-	    --gnulib-version=$(gnulib-version)				\
+	    $$(case ,$(bootstrap-tools), in (*,gnulib,*)		\
+	       echo --gnulib-version=$(gnulib-version);; esac)		\
 	    --no-print-checksums					\
 	    $(addprefix --url-dir=, $(url_dir_list))
 
@@ -1311,7 +1332,7 @@ alpha beta stable: $(local-check) writable-files $(submodule-checks)
 	$(MAKE) vc-diff-check
 	$(MAKE) news-check
 	$(MAKE) distcheck
-	$(MAKE) dist XZ_OPT=-9ev
+	$(MAKE) dist
 	$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
 	$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
 


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Fri Mar 09 10:40:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S61w3-0004xC-1O
	for mharc-libtasn1-commit@gnu.org; Fri, 09 Mar 2012 10:40:51 -0500
Received: from eggs.gnu.org ([208.118.235.92]:53190)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S61vx-0004wE-0s
	for libtasn1-commit@gnu.org; Fri, 09 Mar 2012 10:40:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S61vv-0006FZ-0a
	for libtasn1-commit@gnu.org; Fri, 09 Mar 2012 10:40:44 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37084)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S61vu-0006FU-Td
	for libtasn1-commit@gnu.org; Fri, 09 Mar 2012 10:40:42 -0500
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S61vt-0005As-Ux
	for libtasn1-commit@gnu.org; Fri, 09 Mar 2012 15:40:42 +0000
Date: Fri, 09 Mar 2012 15:40:41 +0000
Message-Id: <E1S61vt-0005As-Ux@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-9-gf2ffa80
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 2259a29c5ae7c34c7709235c96f47a069c2394bb
X-Git-Newrev: f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Mar 2012 15:40:49 -0000

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=f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a

The branch, master has been updated
       via  f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a (commit)
      from  2259a29c5ae7c34c7709235c96f47a069c2394bb (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 f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a
Author: Simon Josefsson <simon@josefsson.org>
Date:   Fri Mar 9 12:31:59 2012 +0100

    Add.

-----------------------------------------------------------------------

Summary of changes:
 NEWS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index c3b49fa..6a7b833 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 GNU Libtasn1 NEWS                                     -*- outline -*-
 
 * Noteworthy changes in release 2.12 (????-??-??) [?]
+- Cleanup license headers.
 - build: Update gnulib files.
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 14:28:32 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7WSW-0000ZH-UR
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:28:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34043)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WSL-0000Ba-0e
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:28:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WSD-0004Bs-MG
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:28:20 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:55415)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WSD-0004Bk-GA
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:28:13 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WSC-0007yA-CH
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:28:13 +0000
Date: Tue, 13 Mar 2012 18:28:12 +0000
Message-Id: <E1S7WSC-0007yA-CH@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-18-g826a8eb
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a
X-Git-Newrev: 826a8eb8dd5bad46d15b2dd58a54938acd36af71
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 18:28:32 -0000

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=826a8eb8dd5bad46d15b2dd58a54938acd36af71

The branch, master has been updated
       via  826a8eb8dd5bad46d15b2dd58a54938acd36af71 (commit)
       via  ae041943ec3d102a736ab58d379f346fea3b2179 (commit)
       via  ac7e267d3acbcb6c9ac21b0a97bdc926417ea3a0 (commit)
       via  61d7d003794d910a2cd9888c0843641db7f50b56 (commit)
       via  5064b07f6bd025ba5ad33a41b39faceeb0ad77b4 (commit)
       via  627774dea5e3202f4e6a1ab7ef32b6c07d0f4ec9 (commit)
       via  5549db25e83d9cf7529af3df8e99c0fad1fd1c50 (commit)
       via  4a0bfa376641d3c7b7650a979f7e815d1a86a801 (commit)
       via  8dc13c5da14b256ef7e489dac143a61c12cdcfb0 (commit)
      from  f2ffa802bee8f2cf2eb3f2c2eee094e2385b2b0a (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 826a8eb8dd5bad46d15b2dd58a54938acd36af71
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 19:33:30 2012 +0100

    check for overflows

commit ae041943ec3d102a736ab58d379f346fea3b2179
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 19:30:29 2012 +0100

    int is signed.

commit ac7e267d3acbcb6c9ac21b0a97bdc926417ea3a0
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 19:15:25 2012 +0100

    bumped shared lib version

commit 61d7d003794d910a2cd9888c0843641db7f50b56
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 23:11:45 2012 +0100

    Added asn1_get_length_der_checked() to put some of the common checks in a single function.

commit 5064b07f6bd025ba5ad33a41b39faceeb0ad77b4
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 22:59:03 2012 +0100

    cleanups in asn1_der_decoding_element().

commit 627774dea5e3202f4e6a1ab7ef32b6c07d0f4ec9
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 22:50:12 2012 +0100

    API is based on integers instead of long to prevent errors in systems where sizeof(int)!=sizeof(long)

commit 5549db25e83d9cf7529af3df8e99c0fad1fd1c50
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 22:47:38 2012 +0100

    asn1_get_length_der() may handle up to signed long values.

commit 4a0bfa376641d3c7b7650a979f7e815d1a86a801
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 21:18:12 2012 +0100

    updated to bison 2.5

commit 8dc13c5da14b256ef7e489dac143a61c12cdcfb0
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sun Mar 4 21:17:54 2012 +0100

    better cleanup in decoding.

-----------------------------------------------------------------------

Summary of changes:
 NEWS           |    2 +
 configure.ac   |    4 +-
 lib/ASN1.c     |  862 ++++++++++++++++++++++++++++++--------------------------
 lib/coding.c   |    2 +-
 lib/decoding.c |  416 +++++++++++++++++-----------
 lib/libtasn1.h |    6 +-
 6 files changed, 719 insertions(+), 573 deletions(-)

diff --git a/NEWS b/NEWS
index 6a7b833..fae31ed 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ GNU Libtasn1 NEWS                                     -*- outline -*-
 * Noteworthy changes in release 2.12 (????-??-??) [?]
 - Cleanup license headers.
 - build: Update gnulib files.
+- API is based on integers instead of long to prevent errors in systems
+  where sizeof(int)!=sizeof(long).
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]
 - qa: Now builds without compiler warnings with Solaris CC.
diff --git a/configure.ac b/configure.ac
index 40d910b..13e0fed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,8 +29,8 @@ AM_SILENT_RULES([yes])
 # Interfaces added:                             AGE++
 # Interfaces removed:                           AGE=0
 AC_SUBST(LT_CURRENT, 4)
-AC_SUBST(LT_REVISION, 14)
-AC_SUBST(LT_AGE, 1)
+AC_SUBST(LT_REVISION, 0)
+AC_SUBST(LT_AGE, 0)
 
 AC_PROG_CC
 gl_EARLY
diff --git a/lib/ASN1.c b/lib/ASN1.c
index 25366b4..d9b9133 100644
--- a/lib/ASN1.c
+++ b/lib/ASN1.c
@@ -1,10 +1,8 @@
+/* A Bison parser, made by GNU Bison 2.5.  */
 
-/* A Bison parser, made by GNU Bison 2.4.1.  */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.5"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -75,12 +73,11 @@
 
 /* Copy the first part of user declarations.  */
 
-/* Line 189 of yacc.c  */
+/* Line 268 of yacc.c  */
 #line 1 "ASN1.y"
 
 /*
- * Copyright (C) 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010, 2011
- * Free Software Foundation, Inc.
+ * Copyright (C) 2001-2012 Free Software Foundation, Inc.
  *
  * This file is part of LIBTASN1.
  *
@@ -131,8 +128,8 @@ static int _asn1_yylex(void);
 
 
 
-/* Line 189 of yacc.c  */
-#line 136 "ASN1.c"
+/* Line 268 of yacc.c  */
+#line 133 "ASN1.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -246,8 +243,8 @@ static int _asn1_yylex(void);
 typedef union YYSTYPE
 {
 
-/* Line 214 of yacc.c  */
-#line 58 "ASN1.y"
+/* Line 293 of yacc.c  */
+#line 57 "ASN1.y"
 
   unsigned int constant;
   char str[ASN1_MAX_NAME_SIZE+1];
@@ -255,8 +252,8 @@ typedef union YYSTYPE
 
 
 
-/* Line 214 of yacc.c  */
-#line 260 "ASN1.c"
+/* Line 293 of yacc.c  */
+#line 257 "ASN1.c"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -267,8 +264,8 @@ typedef union YYSTYPE
 /* Copy the second part of user declarations.  */
 
 
-/* Line 264 of yacc.c  */
-#line 272 "ASN1.c"
+/* Line 343 of yacc.c  */
+#line 269 "ASN1.c"
 
 #ifdef short
 # undef short
@@ -318,7 +315,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -371,11 +368,11 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
 #     endif
 #    endif
 #   endif
@@ -398,24 +395,24 @@ YYID (yyi)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
 	     && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
@@ -444,23 +441,7 @@ union yyalloc
      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
       + YYSTACK_GAP_MAXIMUM)
 
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
-#  endif
-# endif
+# define YYCOPY_NEEDED 1
 
 /* Relocate STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -480,6 +461,26 @@ union yyalloc
 
 #endif
 
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  5
 /* YYLAST -- Last index in YYTABLE.  */
@@ -594,16 +595,16 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   119,   119,   132,   133,   136,   140,   141,   144,   145,
-     148,   149,   152,   154,   159,   160,   164,   166,   171,   172,
-     176,   177,   178,   181,   183,   187,   188,   189,   192,   194,
-     195,   199,   200,   204,   205,   207,   208,   215,   218,   219,
-     222,   224,   230,   231,   234,   235,   239,   240,   244,   249,
-     250,   254,   255,   256,   261,   267,   270,   272,   275,   276,
-     277,   278,   279,   280,   281,   282,   283,   284,   285,   286,
-     287,   290,   291,   296,   297,   300,   303,   306,   307,   311,
-     313,   315,   320,   322,   324,   329,   333,   334,   339,   342,
-     346,   351,   357,   358,   361,   362,   366,   369,   393,   394
+       0,   118,   118,   131,   132,   135,   139,   140,   143,   144,
+     147,   148,   151,   153,   158,   159,   163,   165,   170,   171,
+     175,   176,   177,   180,   182,   186,   187,   188,   191,   193,
+     194,   198,   199,   203,   204,   206,   207,   214,   217,   218,
+     221,   223,   229,   230,   233,   234,   238,   239,   243,   248,
+     249,   253,   254,   255,   260,   266,   269,   271,   274,   275,
+     276,   277,   278,   279,   280,   281,   282,   283,   284,   285,
+     286,   289,   290,   295,   296,   299,   302,   305,   306,   310,
+     312,   314,   319,   321,   323,   328,   332,   333,   338,   341,
+     345,   350,   356,   357,   360,   361,   365,   368,   392,   393
 };
 #endif
 
@@ -678,8 +679,8 @@ static const yytype_uint8 yyr2[] =
        6,     4,     1,     1,     1,     2,     4,     3,     1,     1
 };
 
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE doesn't specify something else to do.  Zero
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
@@ -752,8 +753,7 @@ static const yytype_int16 yypgoto[] =
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
 #define YYTABLE_NINF -9
 static const yytype_int16 yytable[] =
 {
@@ -779,6 +779,12 @@ static const yytype_int16 yytable[] =
      189,     0,    34
 };
 
+#define yypact_value_is_default(yystate) \
+  ((yystate) == (-96))
+
+#define yytable_value_is_error(yytable_value) \
+  YYID (0)
+
 static const yytype_int16 yycheck[] =
 {
       12,    96,    96,    52,     4,     5,     4,     5,     4,     5,
@@ -840,9 +846,18 @@ static const yytype_uint8 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
 
 #define YYFAIL		goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -852,7 +867,6 @@ do								\
     {								\
       yychar = (Token);						\
       yylval = (Value);						\
-      yytoken = YYTRANSLATE (yychar);				\
       YYPOPSTACK (1);						\
       goto yybackup;						\
     }								\
@@ -894,19 +908,10 @@ while (YYID (0))
 #endif
 
 
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
+/* This macro is provided for backward compatibility. */
 
 #ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-#  define YY_LOCATION_PRINT(File, Loc)			\
-     fprintf (File, "%d.%d-%d.%d",			\
-	      (Loc).first_line, (Loc).first_column,	\
-	      (Loc).last_line,  (Loc).last_column)
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
 #endif
 
 
@@ -1098,7 +1103,6 @@ int yydebug;
 # define YYMAXDEPTH 10000
 #endif
 
-
 
 #if YYERROR_VERBOSE
 
@@ -1201,115 +1205,142 @@ yytnamerr (char *yyres, const char *yystr)
 }
 # endif
 
-/* Copy into YYRESULT an error message about the unexpected token
-   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
-   including the terminating null byte.  If YYRESULT is null, do not
-   copy anything; just return the number of bytes that would be
-   copied.  As a special case, return 0 if an ordinary "syntax error"
-   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
-   size calculation.  */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
-  int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
 
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
-    return 0;
-  else
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  YYSIZE_T yysize1;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = 0;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - Assume YYFAIL is not used.  It's too flawed to consider.  See
+       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+       for details.  YYERROR is fine as it does not invoke this
+       function.
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
     {
-      int yytype = YYTRANSLATE (yychar);
-      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
-      YYSIZE_T yysize = yysize0;
-      YYSIZE_T yysize1;
-      int yysize_overflow = 0;
-      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-      int yyx;
-
-# if 0
-      /* This is so xgettext sees the translatable formats that are
-	 constructed on the fly.  */
-      YY_("syntax error, unexpected %s");
-      YY_("syntax error, unexpected %s, expecting %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
-      char *yyfmt;
-      char const *yyf;
-      static char const yyunexpected[] = "syntax error, unexpected %s";
-      static char const yyexpecting[] = ", expecting %s";
-      static char const yyor[] = " or %s";
-      char yyformat[sizeof yyunexpected
-		    + sizeof yyexpecting - 1
-		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
-		       * (sizeof yyor - 1))];
-      char const *yyprefix = yyexpecting;
-
-      /* Start YYX at -YYN if negative to avoid negative indexes in
-	 YYCHECK.  */
-      int yyxbegin = yyn < 0 ? -yyn : 0;
-
-      /* Stay within bounds of both yycheck and yytname.  */
-      int yychecklim = YYLAST - yyn + 1;
-      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-      int yycount = 1;
-
-      yyarg[0] = yytname[yytype];
-      yyfmt = yystpcpy (yyformat, yyunexpected);
-
-      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-	  {
-	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-	      {
-		yycount = 1;
-		yysize = yysize0;
-		yyformat[sizeof yyunexpected - 1] = '\0';
-		break;
-	      }
-	    yyarg[yycount++] = yytname[yyx];
-	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-	    yysize_overflow |= (yysize1 < yysize);
-	    yysize = yysize1;
-	    yyfmt = yystpcpy (yyfmt, yyprefix);
-	    yyprefix = yyor;
-	  }
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+                if (! (yysize <= yysize1
+                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  return 2;
+                yysize = yysize1;
+              }
+        }
+    }
 
-      yyf = YY_(yyformat);
-      yysize1 = yysize + yystrlen (yyf);
-      yysize_overflow |= (yysize1 < yysize);
-      yysize = yysize1;
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+    }
 
-      if (yysize_overflow)
-	return YYSIZE_MAXIMUM;
+  yysize1 = yysize + yystrlen (yyformat);
+  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    return 2;
+  yysize = yysize1;
 
-      if (yyresult)
-	{
-	  /* Avoid sprintf, as that infringes on the user's name space.
-	     Don't have undefined behavior even if the translation
-	     produced a string with the wrong number of "%s"s.  */
-	  char *yyp = yyresult;
-	  int yyi = 0;
-	  while ((*yyp = *yyf) != '\0')
-	    {
-	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
-		{
-		  yyp += yytnamerr (yyp, yyarg[yyi++]);
-		  yyf += 2;
-		}
-	      else
-		{
-		  yyp++;
-		  yyf++;
-		}
-	    }
-	}
-      return yysize;
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
     }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
 }
 #endif /* YYERROR_VERBOSE */
-
 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
@@ -1342,6 +1373,7 @@ yydestruct (yymsg, yytype, yyvaluep)
     }
 }
 
+
 /* Prevent warnings from -Wmissing-prototypes.  */
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
@@ -1368,10 +1400,9 @@ YYSTYPE yylval;
 int yynerrs;
 
 
-
-/*-------------------------.
-| yyparse or yypush_parse.  |
-`-------------------------*/
+/*----------.
+| yyparse.  |
+`----------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1395,8 +1426,6 @@ yyparse ()
 #endif
 #endif
 {
-
-
     int yystate;
     /* Number of tokens to shift before error messages enabled.  */
     int yyerrstatus;
@@ -1551,7 +1580,7 @@ yybackup:
 
   /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
+  if (yypact_value_is_default (yyn))
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
@@ -1582,8 +1611,8 @@ yybackup:
   yyn = yytable[yyn];
   if (yyn <= 0)
     {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
-	goto yyerrlab;
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
@@ -1638,8 +1667,8 @@ yyreduce:
     {
         case 2:
 
-/* Line 1455 of yacc.c  */
-#line 122 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 121 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_DEFINITIONS|(yyvsp[(3) - (8)].constant));
                     _asn1_set_name((yyval.node),_asn1_get_name((yyvsp[(1) - (8)].node)));
                     _asn1_set_name((yyvsp[(1) - (8)].node),"");
@@ -1652,80 +1681,80 @@ yyreduce:
 
   case 3:
 
-/* Line 1455 of yacc.c  */
-#line 132 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 131 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 4:
 
-/* Line 1455 of yacc.c  */
-#line 133 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 132 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(2) - (2)].str));}
     break;
 
   case 5:
 
-/* Line 1455 of yacc.c  */
-#line 136 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 135 "ASN1.y"
     {strcpy((yyval.str),"-");
                        strcat((yyval.str),(yyvsp[(2) - (2)].str));}
     break;
 
   case 6:
 
-/* Line 1455 of yacc.c  */
-#line 140 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 139 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 7:
 
-/* Line 1455 of yacc.c  */
-#line 141 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 140 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 8:
 
-/* Line 1455 of yacc.c  */
-#line 144 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 143 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 9:
 
-/* Line 1455 of yacc.c  */
-#line 145 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 144 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 10:
 
-/* Line 1455 of yacc.c  */
-#line 148 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 147 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 11:
 
-/* Line 1455 of yacc.c  */
-#line 149 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 148 "ASN1.y"
     {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
     break;
 
   case 12:
 
-/* Line 1455 of yacc.c  */
-#line 152 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 151 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CONSTANT);
                                        _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);}
     break;
 
   case 13:
 
-/* Line 1455 of yacc.c  */
-#line 154 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 153 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CONSTANT);
 	                               _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
                                        _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
@@ -1733,31 +1762,31 @@ yyreduce:
 
   case 14:
 
-/* Line 1455 of yacc.c  */
-#line 159 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 158 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 15:
 
-/* Line 1455 of yacc.c  */
-#line 160 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 159 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (3)].node);
                                             _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
     break;
 
   case 16:
 
-/* Line 1455 of yacc.c  */
-#line 164 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 163 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CONSTANT);
                                    _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);}
     break;
 
   case 17:
 
-/* Line 1455 of yacc.c  */
-#line 166 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 165 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CONSTANT);
 	                            _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
                                     _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
@@ -1765,125 +1794,125 @@ yyreduce:
 
   case 18:
 
-/* Line 1455 of yacc.c  */
-#line 171 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 170 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 19:
 
-/* Line 1455 of yacc.c  */
-#line 172 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 171 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (2)].node);
                                                     _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (2)].node)),(yyvsp[(2) - (2)].node));}
     break;
 
   case 20:
 
-/* Line 1455 of yacc.c  */
-#line 176 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 175 "ASN1.y"
     {(yyval.constant)=CONST_UNIVERSAL;}
     break;
 
   case 21:
 
-/* Line 1455 of yacc.c  */
-#line 177 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 176 "ASN1.y"
     {(yyval.constant)=CONST_PRIVATE;}
     break;
 
   case 22:
 
-/* Line 1455 of yacc.c  */
-#line 178 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 177 "ASN1.y"
     {(yyval.constant)=CONST_APPLICATION;}
     break;
 
   case 23:
 
-/* Line 1455 of yacc.c  */
-#line 181 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 180 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_TAG);
                             _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);}
     break;
 
   case 24:
 
-/* Line 1455 of yacc.c  */
-#line 183 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 182 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_TAG | (yyvsp[(2) - (4)].constant));
                                 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
     break;
 
   case 25:
 
-/* Line 1455 of yacc.c  */
-#line 187 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 186 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 26:
 
-/* Line 1455 of yacc.c  */
-#line 188 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 187 "ASN1.y"
     {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_EXPLICIT);}
     break;
 
   case 27:
 
-/* Line 1455 of yacc.c  */
-#line 189 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 188 "ASN1.y"
     {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_IMPLICIT);}
     break;
 
   case 28:
 
-/* Line 1455 of yacc.c  */
-#line 192 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 191 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_DEFAULT);
                                        _asn1_set_value((yyval.node),(yyvsp[(2) - (2)].str),strlen((yyvsp[(2) - (2)].str))+1);}
     break;
 
   case 29:
 
-/* Line 1455 of yacc.c  */
-#line 194 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 193 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);}
     break;
 
   case 30:
 
-/* Line 1455 of yacc.c  */
-#line 195 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 194 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);}
     break;
 
   case 33:
 
-/* Line 1455 of yacc.c  */
-#line 204 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 203 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_INTEGER);}
     break;
 
   case 34:
 
-/* Line 1455 of yacc.c  */
-#line 205 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 204 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_LIST);
 	                                 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
     break;
 
   case 35:
 
-/* Line 1455 of yacc.c  */
-#line 207 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 206 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_INTEGER);}
     break;
 
   case 36:
 
-/* Line 1455 of yacc.c  */
-#line 209 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 208 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX);
                                          _asn1_set_down((yyval.node),_asn1_add_node(TYPE_SIZE));
                                          _asn1_set_value(_asn1_get_down((yyval.node)),(yyvsp[(6) - (7)].str),strlen((yyvsp[(6) - (7)].str))+1);
@@ -1892,37 +1921,37 @@ yyreduce:
 
   case 37:
 
-/* Line 1455 of yacc.c  */
-#line 215 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 214 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_BOOLEAN);}
     break;
 
   case 38:
 
-/* Line 1455 of yacc.c  */
-#line 218 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 217 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_TIME|CONST_UTC);}
     break;
 
   case 39:
 
-/* Line 1455 of yacc.c  */
-#line 219 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 218 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);}
     break;
 
   case 40:
 
-/* Line 1455 of yacc.c  */
-#line 222 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 221 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM);
 	                              _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
     break;
 
   case 41:
 
-/* Line 1455 of yacc.c  */
-#line 225 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 224 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX);
 	                              _asn1_set_value((yyval.node),(yyvsp[(3) - (7)].str),strlen((yyvsp[(3) - (7)].str))+1);
                                       _asn1_set_name((yyval.node),(yyvsp[(6) - (7)].str));}
@@ -1930,52 +1959,52 @@ yyreduce:
 
   case 42:
 
-/* Line 1455 of yacc.c  */
-#line 230 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 229 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 43:
 
-/* Line 1455 of yacc.c  */
-#line 231 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 230 "ASN1.y"
     {(yyval.node)=(yyvsp[(2) - (3)].node);}
     break;
 
   case 44:
 
-/* Line 1455 of yacc.c  */
-#line 234 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 233 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_GENERALSTRING);}
     break;
 
   case 45:
 
-/* Line 1455 of yacc.c  */
-#line 235 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 234 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE);
 					  _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
     break;
 
   case 46:
 
-/* Line 1455 of yacc.c  */
-#line 239 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 238 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OCTET_STRING);}
     break;
 
   case 47:
 
-/* Line 1455 of yacc.c  */
-#line 240 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 239 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE);
                                            _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
     break;
 
   case 48:
 
-/* Line 1455 of yacc.c  */
-#line 244 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 243 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CONSTANT);
 	                           _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
                                     _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
@@ -1983,68 +2012,68 @@ yyreduce:
 
   case 49:
 
-/* Line 1455 of yacc.c  */
-#line 249 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 248 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 50:
 
-/* Line 1455 of yacc.c  */
-#line 250 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 249 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (3)].node);
                                                        _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
     break;
 
   case 51:
 
-/* Line 1455 of yacc.c  */
-#line 254 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 253 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING);}
     break;
 
   case 52:
 
-/* Line 1455 of yacc.c  */
-#line 255 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 254 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING|CONST_SIZE);}
     break;
 
   case 53:
 
-/* Line 1455 of yacc.c  */
-#line 257 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 256 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST);
                                 _asn1_set_down((yyval.node),(yyvsp[(4) - (5)].node));}
     break;
 
   case 54:
 
-/* Line 1455 of yacc.c  */
-#line 262 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 261 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST);
                                 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
     break;
 
   case 55:
 
-/* Line 1455 of yacc.c  */
-#line 267 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 266 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID);}
     break;
 
   case 56:
 
-/* Line 1455 of yacc.c  */
-#line 270 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 269 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_IDENTIFIER);
                                        _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);}
     break;
 
   case 57:
 
-/* Line 1455 of yacc.c  */
-#line 272 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 271 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE);
                                        _asn1_set_value((yyval.node),(yyvsp[(1) - (2)].str),strlen((yyvsp[(1) - (2)].str))+1);
                                        _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
@@ -2052,99 +2081,99 @@ yyreduce:
 
   case 58:
 
-/* Line 1455 of yacc.c  */
-#line 275 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 274 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 59:
 
-/* Line 1455 of yacc.c  */
-#line 276 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 275 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 60:
 
-/* Line 1455 of yacc.c  */
-#line 277 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 276 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 62:
 
-/* Line 1455 of yacc.c  */
-#line 279 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 278 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 63:
 
-/* Line 1455 of yacc.c  */
-#line 280 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 279 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 64:
 
-/* Line 1455 of yacc.c  */
-#line 281 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 280 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 65:
 
-/* Line 1455 of yacc.c  */
-#line 282 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 281 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 66:
 
-/* Line 1455 of yacc.c  */
-#line 283 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 282 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 67:
 
-/* Line 1455 of yacc.c  */
-#line 284 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 283 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 68:
 
-/* Line 1455 of yacc.c  */
-#line 285 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 284 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 69:
 
-/* Line 1455 of yacc.c  */
-#line 286 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 285 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 70:
 
-/* Line 1455 of yacc.c  */
-#line 287 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 286 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_NULL);}
     break;
 
   case 71:
 
-/* Line 1455 of yacc.c  */
-#line 290 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 289 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 72:
 
-/* Line 1455 of yacc.c  */
-#line 291 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 290 "ASN1.y"
     {(yyval.node)=_asn1_mod_type((yyvsp[(2) - (2)].node),CONST_TAG);
                                                _asn1_set_right((yyvsp[(1) - (2)].node),_asn1_get_down((yyval.node)));
                                                _asn1_set_down((yyval.node),(yyvsp[(1) - (2)].node));}
@@ -2152,15 +2181,15 @@ yyreduce:
 
   case 73:
 
-/* Line 1455 of yacc.c  */
-#line 296 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 295 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 74:
 
-/* Line 1455 of yacc.c  */
-#line 297 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 296 "ASN1.y"
     {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_DEFAULT);
                                                        _asn1_set_right((yyvsp[(2) - (2)].node),_asn1_get_down((yyval.node)));
 						       _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
@@ -2168,53 +2197,53 @@ yyreduce:
 
   case 75:
 
-/* Line 1455 of yacc.c  */
-#line 300 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 299 "ASN1.y"
     {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_OPTION);}
     break;
 
   case 76:
 
-/* Line 1455 of yacc.c  */
-#line 303 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 302 "ASN1.y"
     {(yyval.node)=_asn1_set_name((yyvsp[(2) - (2)].node),(yyvsp[(1) - (2)].str));}
     break;
 
   case 77:
 
-/* Line 1455 of yacc.c  */
-#line 306 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 305 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 78:
 
-/* Line 1455 of yacc.c  */
-#line 307 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 306 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (3)].node);
                                                 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
     break;
 
   case 79:
 
-/* Line 1455 of yacc.c  */
-#line 311 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 310 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE);
                                               _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
     break;
 
   case 80:
 
-/* Line 1455 of yacc.c  */
-#line 313 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 312 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE_OF);
                                               _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
     break;
 
   case 81:
 
-/* Line 1455 of yacc.c  */
-#line 315 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 314 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE);
                                             _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node));
                                             _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));}
@@ -2222,24 +2251,24 @@ yyreduce:
 
   case 82:
 
-/* Line 1455 of yacc.c  */
-#line 320 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 319 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SET);
                                      _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
     break;
 
   case 83:
 
-/* Line 1455 of yacc.c  */
-#line 322 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 321 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SET_OF);
                                      _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
     break;
 
   case 84:
 
-/* Line 1455 of yacc.c  */
-#line 324 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 323 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_SET_OF|CONST_SIZE);
                                        _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node));
                                        _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));}
@@ -2247,23 +2276,23 @@ yyreduce:
 
   case 85:
 
-/* Line 1455 of yacc.c  */
-#line 329 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 328 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_CHOICE);
                                              _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
     break;
 
   case 86:
 
-/* Line 1455 of yacc.c  */
-#line 333 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 332 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_ANY);}
     break;
 
   case 87:
 
-/* Line 1455 of yacc.c  */
-#line 334 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 333 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY);
                                         _asn1_set_down((yyval.node),_asn1_add_node(TYPE_CONSTANT));
 	                                _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[(4) - (4)].str));}
@@ -2271,15 +2300,15 @@ yyreduce:
 
   case 88:
 
-/* Line 1455 of yacc.c  */
-#line 339 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 338 "ASN1.y"
     {(yyval.node)=_asn1_set_name((yyvsp[(3) - (3)].node),(yyvsp[(1) - (3)].str));}
     break;
 
   case 89:
 
-/* Line 1455 of yacc.c  */
-#line 343 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 342 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN);
                          _asn1_set_name((yyval.node),(yyvsp[(1) - (7)].str));
                          _asn1_set_down((yyval.node),(yyvsp[(6) - (7)].node));}
@@ -2287,8 +2316,8 @@ yyreduce:
 
   case 90:
 
-/* Line 1455 of yacc.c  */
-#line 347 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 346 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
                          _asn1_set_name((yyval.node),(yyvsp[(1) - (6)].str));
                          _asn1_set_value((yyval.node),(yyvsp[(2) - (6)].str),strlen((yyvsp[(2) - (6)].str))+1);
@@ -2297,8 +2326,8 @@ yyreduce:
 
   case 91:
 
-/* Line 1455 of yacc.c  */
-#line 352 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 351 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN);
                          _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
                          _asn1_set_value((yyval.node),(yyvsp[(4) - (4)].str),strlen((yyvsp[(4) - (4)].str))+1);}
@@ -2306,37 +2335,37 @@ yyreduce:
 
   case 92:
 
-/* Line 1455 of yacc.c  */
-#line 357 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 356 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 93:
 
-/* Line 1455 of yacc.c  */
-#line 358 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 357 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 94:
 
-/* Line 1455 of yacc.c  */
-#line 361 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 360 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (1)].node);}
     break;
 
   case 95:
 
-/* Line 1455 of yacc.c  */
-#line 362 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 361 "ASN1.y"
     {(yyval.node)=(yyvsp[(1) - (2)].node);
                                                           _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (2)].node)),(yyvsp[(2) - (2)].node));}
     break;
 
   case 96:
 
-/* Line 1455 of yacc.c  */
-#line 366 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 365 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID);
                                                           _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));
                                                           _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));}
@@ -2344,32 +2373,43 @@ yyreduce:
 
   case 97:
 
-/* Line 1455 of yacc.c  */
-#line 369 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 368 "ASN1.y"
     {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID);
                                                           _asn1_set_name((yyval.node),(yyvsp[(1) - (3)].str));}
     break;
 
   case 98:
 
-/* Line 1455 of yacc.c  */
-#line 393 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 392 "ASN1.y"
     {(yyval.constant)=CONST_EXPLICIT;}
     break;
 
   case 99:
 
-/* Line 1455 of yacc.c  */
-#line 394 "ASN1.y"
+/* Line 1806 of yacc.c  */
+#line 393 "ASN1.y"
     {(yyval.constant)=CONST_IMPLICIT;}
     break;
 
 
 
-/* Line 1455 of yacc.c  */
-#line 2371 "ASN1.c"
+/* Line 1806 of yacc.c  */
+#line 2400 "ASN1.c"
       default: break;
     }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
@@ -2397,6 +2437,10 @@ yyreduce:
 | yyerrlab -- here on detecting error |
 `------------------------------------*/
 yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
@@ -2404,37 +2448,36 @@ yyerrlab:
 #if ! YYERROR_VERBOSE
       yyerror (YY_("syntax error"));
 #else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
       {
-	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
-	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
-	  {
-	    YYSIZE_T yyalloc = 2 * yysize;
-	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
-	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
-	    if (yymsg != yymsgbuf)
-	      YYSTACK_FREE (yymsg);
-	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
-	    if (yymsg)
-	      yymsg_alloc = yyalloc;
-	    else
-	      {
-		yymsg = yymsgbuf;
-		yymsg_alloc = sizeof yymsgbuf;
-	      }
-	  }
-
-	if (0 < yysize && yysize <= yymsg_alloc)
-	  {
-	    (void) yysyntax_error (yymsg, yystate, yychar);
-	    yyerror (yymsg);
-	  }
-	else
-	  {
-	    yyerror (YY_("syntax error"));
-	    if (yysize != 0)
-	      goto yyexhaustedlab;
-	  }
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
       }
+# undef YYSYNTAX_ERROR
 #endif
     }
 
@@ -2493,7 +2536,7 @@ yyerrlab1:
   for (;;)
     {
       yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
+      if (!yypact_value_is_default (yyn))
 	{
 	  yyn += YYTERROR;
 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2552,8 +2595,13 @@ yyexhaustedlab:
 
 yyreturn:
   if (yychar != YYEMPTY)
-     yydestruct ("Cleanup: discarding lookahead",
-		 yytoken, &yylval);
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
   /* Do not reclaim the symbols of the rule which action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
@@ -2578,8 +2626,8 @@ yyreturn:
 
 
 
-/* Line 1675 of yacc.c  */
-#line 398 "ASN1.y"
+/* Line 2067 of yacc.c  */
+#line 397 "ASN1.y"
 
 
 
diff --git a/lib/coding.c b/lib/coding.c
index 8b72eba..a1896d5 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -68,7 +68,7 @@ _asn1_error_description_value_not_found (ASN1_TYPE node,
  * The @ans buffer is pre-allocated and must have room for the output.
  **/
 void
-asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
+asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len)
 {
   int k;
   unsigned char temp[SIZEOF_UNSIGNED_LONG_INT];
diff --git a/lib/decoding.c b/lib/decoding.c
index 8c46ce5..32888a3 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -56,10 +56,10 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
  * Returns: Return the decoded length value, or -1 on indefinite
  *   length, or -2 when the value was too big.
  **/
-signed long
+int
 asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
-  unsigned long ans;
+  int ans;
   int k, punt;
 
   *len = 0;
@@ -100,6 +100,35 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len)
     }
 }
 
+/*-
+ * asn1_get_length_der_checked:
+ * @der: DER data to decode.
+ * @der_len: Length of DER data to decode.
+ * @len: Output variable containing the length of the DER length field.
+ *
+ * Extract a length field from DER data.
+ *
+ * Returns: Return the decoded length value, or -1 on indefinite
+ *   length, -2 when the value was too big or -3 when the value
+ *   and the size of length exceed the @der_len.
+ -*/
+static int
+asn1_get_length_der_checked (const unsigned char *der, int der_len, int *len)
+{
+int ret, tot;
+
+  ret = asn1_get_length_der(der, der_len, len);
+  if (ret < 0)
+    return ret;
+  
+  tot = ret + *len;
+  
+  if (tot < 0 || tot > der_len)
+    return -3;
+
+  return ret;
+}
+
 /**
  * asn1_get_tag_der:
  * @der: DER data to decode.
@@ -172,7 +201,7 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
  *
  * Since: 2.0
  **/
-signed long
+int
 asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
 {
   int ret;
@@ -662,7 +691,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
   if (*(der - 1) & ASN1_CLASS_STRUCTURED)
     {
       tot_len = 0;
-      indefinite = asn1_get_length_der (der, *len, &len3);
+      indefinite = asn1_get_length_der_checked (der, *len, &len3);
       if (indefinite < -1)
 	return ASN1_DER_ERROR;
 
@@ -691,7 +720,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
 
 	  counter++;
 
-	  len2 = asn1_get_length_der (der + counter, *len - counter, &len3);
+	  len2 = asn1_get_length_der_checked (der + counter, *len - counter, &len3);
 	  if (len2 <= 0)
 	    return ASN1_DER_ERROR;
 
@@ -720,11 +749,9 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
     }
   else
     {				/* NOT STRUCTURED */
-      len2 = asn1_get_length_der (der, *len, &len3);
+      len2 = asn1_get_length_der_checked (der, *len, &len3);
       if (len2 < 0)
 	return ASN1_DER_ERROR;
-      if (len3 + len2 > *len)
-	return ASN1_DER_ERROR;
       if (node)
 	_asn1_set_value (node, der, len3 + len2);
       counter = len3 + len2;
@@ -823,8 +850,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (element);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   counter = 0;
@@ -857,8 +884,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		}
 	      else if (counter > len2)
 		{
-		  asn1_delete_structure (element);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	      p2 = p2->down;
 	      while (p2)
@@ -893,8 +920,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		}
 	      if (p2 == NULL)
 		{
-		  asn1_delete_structure (element);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	    }
 
@@ -941,8 +968,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		    }
 		  else if (ris == ASN1_ERROR_TYPE_ANY)
 		    {
-		      asn1_delete_structure (element);
-		      return ASN1_ERROR_TYPE_ANY;
+		      result = ASN1_ERROR_TYPE_ANY;
+		      goto cleanup;
 		    }
 		  else
 		    {
@@ -955,8 +982,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		{
 		  if (!(p->type & CONST_OPTION))
 		    {
-		      asn1_delete_structure (element);
-		      return ASN1_DER_ERROR;
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
 		    }
 		}
 	      else
@@ -991,8 +1018,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		  if (errorDescription != NULL)
 		    _asn1_error_description_tag_error (p, errorDescription);
 
-		  asn1_delete_structure (element);
-		  return ASN1_TAG_ERROR;
+		  result = ASN1_TAG_ERROR;
+		  goto cleanup;
 		}
 	    }
 	  else
@@ -1006,8 +1033,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	    case TYPE_NULL:
 	      if (der[counter])
 		{
-		  asn1_delete_structure (element);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	      counter++;
 	      move = RIGHT;
@@ -1015,8 +1042,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	    case TYPE_BOOLEAN:
 	      if (der[counter++] != 1)
 		{
-		  asn1_delete_structure (element);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	      if (der[counter++] == 0)
 		_asn1_set_value (p, "F", 1);
@@ -1027,11 +1054,13 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
-	      if (len2 + len3 > len - counter)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
 	      move = RIGHT;
@@ -1041,10 +1070,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		_asn1_get_objectid_der (der + counter, len - counter, &len2,
 					temp, sizeof (temp));
 	      if (result != ASN1_SUCCESS)
-		{
-		  asn1_delete_structure (element);
-		  return result;
-		}
+                goto cleanup;
 
 	      tlen = strlen (temp);
 	      if (tlen > 0)
@@ -1057,10 +1083,8 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		_asn1_get_time_der (der + counter, len - counter, &len2, temp,
 				    sizeof (temp) - 1);
 	      if (result != ASN1_SUCCESS)
-		{
-		  asn1_delete_structure (element);
-		  return result;
-		}
+		goto cleanup;
+
 	      tlen = strlen (temp);
 	      if (tlen > 0)
 		_asn1_set_value (p, temp, tlen + 1);
@@ -1069,30 +1093,35 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      break;
 	    case TYPE_OCTET_STRING:
 	      len3 = len - counter;
-	      ris = _asn1_get_octet_string (der + counter, p, &len3);
-	      if (ris != ASN1_SUCCESS)
-		return ris;
+	      result = _asn1_get_octet_string (der + counter, p, &len3);
+	      if (result != ASN1_SUCCESS)
+                goto cleanup;
+
 	      counter += len3;
 	      move = RIGHT;
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
-	      if (len3 + len2 > len - counter)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
 	      move = RIGHT;
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
-	      if (len3 + len2 > len - counter)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
 	      move = RIGHT;
@@ -1109,20 +1138,23 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 			{
 			  if ((der[counter]) || der[counter + 1])
 			    {
-			      asn1_delete_structure (element);
-			      return ASN1_DER_ERROR;
+			      result = ASN1_DER_ERROR;
+			      goto cleanup;
 			    }
 			}
 		      else
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		      counter += 2;
 		    }
 		  else
 		    {		/* definite length method */
 		      if (len2 != counter)
 			{
-			  asn1_delete_structure (element);
-			  return ASN1_DER_ERROR;
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
 			}
 		    }
 		  move = RIGHT;
@@ -1130,9 +1162,12 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der (der + counter, len - counter, &len2);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
 		  if (len3 < -1)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  counter += len2;
 		  if (len3 > 0)
 		    {
@@ -1173,7 +1208,11 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		  if (len2 == -1)
 		    {		/* indefinite length method */
 		      if ((counter + 2) > len)
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
+
 		      if ((der[counter]) || der[counter + 1])
 			{
 			  _asn1_append_sequence_set (p);
@@ -1200,17 +1239,20 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		      _asn1_set_value (p, NULL, 0);
 		      if (len2 != counter)
 			{
-			  asn1_delete_structure (element);
-			  return ASN1_DER_ERROR;
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
 			}
 		    }
 		}
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der (der + counter, len - counter, &len2);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
 		  if (len3 < -1)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  counter += len2;
 		  if (len3)
 		    {
@@ -1241,16 +1283,24 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      if (asn1_get_tag_der
 		  (der + counter, len - counter, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
-		return ASN1_DER_ERROR;
+                {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      if (counter + len2 > len)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_get_length_der_checked (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
-		return ASN1_DER_ERROR;
-	      if (len4 > len - counter + len2 + len3)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
 	      if (len4 != -1)
 		{
 		  len2 += len4;
@@ -1266,13 +1316,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		    indefinite = 0;
 
 		  len2 = len - counter;
-		  ris =
+		  result =
 		    _asn1_get_indefinite_length_string (der + counter, &len2);
-		  if (ris != ASN1_SUCCESS)
-		    {
-		      asn1_delete_structure (element);
-		      return ris;
-		    }
+		  if (result != ASN1_SUCCESS)
+		    goto cleanup;
 
 		  _asn1_set_value_octet (p, der + counter, len2);
 		  counter += len2;
@@ -1287,9 +1334,9 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 			}
 		      else
 			{
-			  asn1_delete_structure (element);
-			  return ASN1_DER_ERROR;
-			}
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		    }
 		}
 	      move = RIGHT;
@@ -1325,11 +1372,15 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 
   if (counter != len)
     {
-      asn1_delete_structure (element);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (element);
+  return result;
 }
 
 #define FOUND        1
@@ -1378,14 +1429,14 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 
   if (elementName == NULL)
     {
-      asn1_delete_structure (structure);
-      return ASN1_ELEMENT_NOT_FOUND;
+      result = ASN1_ELEMENT_NOT_FOUND;
+      goto cleanup;
     }
 
   if (node->type & CONST_OPTION)
     {
-      asn1_delete_structure (structure);
-      return ASN1_GENERIC_ERROR;
+      result = ASN1_GENERIC_ERROR;
+      goto cleanup;
     }
 
   if ((*structure)->name)
@@ -1395,8 +1446,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	strcpy (currentName, (*structure)->name);
       else
 	{
-	  asn1_delete_structure (structure);
-	  return ASN1_MEM_ERROR;
+	  result = ASN1_MEM_ERROR;
+	  goto cleanup;
 	}
       if (!(strcmp (currentName, elementName)))
 	{
@@ -1444,8 +1495,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		}
 	      else if (counter > len2)
 		{
-		  asn1_delete_structure (structure);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	      p2 = p2->down;
 	      while (p2)
@@ -1480,8 +1531,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		}
 	      if (p2 == NULL)
 		{
-		  asn1_delete_structure (structure);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 	    }
 
@@ -1528,8 +1579,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    }
 		  else if (ris == ASN1_ERROR_TYPE_ANY)
 		    {
-		      asn1_delete_structure (structure);
-		      return ASN1_ERROR_TYPE_ANY;
+		      result = ASN1_ERROR_TYPE_ANY;
+		      goto cleanup;
 		    }
 		  else
 		    {
@@ -1542,8 +1593,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		{
 		  if (!(p->type & CONST_OPTION))
 		    {
-		      asn1_delete_structure (structure);
-		      return ASN1_DER_ERROR;
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
 		    }
 		}
 	      else
@@ -1578,8 +1629,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  if (errorDescription != NULL)
 		    _asn1_error_description_tag_error (p, errorDescription);
 
-		  asn1_delete_structure (structure);
-		  return ASN1_TAG_ERROR;
+		  result = ASN1_TAG_ERROR;
+		  goto cleanup;
 		}
 	    }
 	  else
@@ -1593,8 +1644,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	    case TYPE_NULL:
 	      if (der[counter])
 		{
-		  asn1_delete_structure (structure);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 
 	      if (p == nodeFound)
@@ -1606,8 +1657,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	    case TYPE_BOOLEAN:
 	      if (der[counter++] != 1)
 		{
-		  asn1_delete_structure (structure);
-		  return ASN1_DER_ERROR;
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
 		}
 
 	      if (state == FOUND)
@@ -1629,13 +1680,20 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      if (state == FOUND)
 		{
 		  if (len3 + len2 > len - counter)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1651,9 +1709,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    _asn1_get_objectid_der (der + counter, len - counter,
 					    &len2, temp, sizeof (temp));
 		  if (result != ASN1_SUCCESS)
-		    {
-		      return result;
-		    }
+		    goto cleanup;
 
 		  tlen = strlen (temp);
 
@@ -1666,9 +1722,12 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der (der + counter, len - counter, &len3);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len3);
 		  if (len2 < 0)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  len2 += len3;
 		}
 
@@ -1682,10 +1741,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    _asn1_get_time_der (der + counter, len - counter, &len2,
 					temp, sizeof (temp) - 1);
 		  if (result != ASN1_SUCCESS)
-		    {
-		      asn1_delete_structure (structure);
-		      return result;
-		    }
+		    goto cleanup;
 
 		  tlen = strlen (temp);
 		  if (tlen > 0)
@@ -1697,9 +1753,12 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der (der + counter, len - counter, &len3);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len3);
 		  if (len2 < 0)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  len2 += len3;
 		}
 
@@ -1710,27 +1769,35 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      len3 = len - counter;
 	      if (state == FOUND)
 		{
-		  ris = _asn1_get_octet_string (der + counter, p, &len3);
+		  result = _asn1_get_octet_string (der + counter, p, &len3);
 		  if (p == nodeFound)
 		    state = EXIT;
 		}
 	      else
-		ris = _asn1_get_octet_string (der + counter, NULL, &len3);
+		result = _asn1_get_octet_string (der + counter, NULL, &len3);
+
+	      if (result != ASN1_SUCCESS)
+		goto cleanup;
 
-	      if (ris != ASN1_SUCCESS)
-		return ris;
 	      counter += len3;
 	      move = RIGHT;
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      if (state == FOUND)
 		{
 		  if (len3 + len2 > len - counter)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1741,13 +1808,19 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
 	      if (state == FOUND)
 		{
 		  if (len3 + len2 > len - counter)
-		    return ASN1_DER_ERROR;
+		    {
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
+                    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1766,8 +1839,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {		/* indefinite length method */
 		      if ((der[counter]) || der[counter + 1])
 			{
-			  asn1_delete_structure (structure);
-			  return ASN1_DER_ERROR;
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
 			}
 		      counter += 2;
 		    }
@@ -1775,8 +1848,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {		/* definite length method */
 		      if (len2 != counter)
 			{
-			  asn1_delete_structure (structure);
-			  return ASN1_DER_ERROR;
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
 			}
 		    }
 		  if (p == nodeFound)
@@ -1788,20 +1861,26 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_get_length_der_checked (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		      counter += len2 + len3;
 		      move = RIGHT;
 		    }
 		  else
 		    {		/*  state==SAME_BRANCH or state==FOUND */
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_get_length_der_checked (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		      counter += len2;
 		      if (len3 > 0)
 			{
@@ -1853,8 +1932,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  _asn1_set_value (p, NULL, 0);
 		  if (len2 != counter)
 		    {
-		      asn1_delete_structure (structure);
-		      return ASN1_DER_ERROR;
+		      result = ASN1_DER_ERROR;
+		      goto cleanup;
 		    }
 
 		  if (p == nodeFound)
@@ -1865,20 +1944,26 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_get_length_der_checked (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		      counter += len2 + len3;
 		      move = RIGHT;
 		    }
 		  else
 		    {		/* state==FOUND or state==SAME_BRANCH */
 		      len3 =
-			asn1_get_length_der (der + counter, len - counter,
+			asn1_get_length_der_checked (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-			return ASN1_DER_ERROR;
+		        {
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
+                        }
 		      counter += len2;
 		      if (len3)
 			{
@@ -1904,15 +1989,25 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      if (asn1_get_tag_der
 		  (der + counter, len - counter, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
-		return ASN1_DER_ERROR;
+                {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
+
 	      if (counter + len2 > len)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
 
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_get_length_der_checked (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
-		return ASN1_DER_ERROR;
+	        {
+		  result = ASN1_DER_ERROR;
+		  goto cleanup;
+                }
 
 	      if (len4 != -1)
 		{
@@ -1935,13 +2030,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    indefinite = 0;
 
 		  len2 = len - counter;
-		  ris =
+		  result =
 		    _asn1_get_indefinite_length_string (der + counter, &len2);
-		  if (ris != ASN1_SUCCESS)
-		    {
-		      asn1_delete_structure (structure);
-		      return ris;
-		    }
+		  if (result != ASN1_SUCCESS)
+		    goto cleanup;
 
 		  if (state == FOUND)
 		    {
@@ -1963,8 +2055,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 			}
 		      else
 			{
-			  asn1_delete_structure (structure);
-			  return ASN1_DER_ERROR;
+			  result = ASN1_DER_ERROR;
+			  goto cleanup;
 			}
 		    }
 		}
@@ -1997,8 +2089,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    }
 		  else
 		    {
-		      asn1_delete_structure (structure);
-		      return ASN1_MEM_ERROR;
+		      result = ASN1_MEM_ERROR;
+		      goto cleanup;
 		    }
 		  if (!(strcmp (currentName, elementName)))
 		    {
@@ -2040,8 +2132,8 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    strcat (currentName, p->name);
 		  else
 		    {
-		      asn1_delete_structure (structure);
-		      return ASN1_MEM_ERROR;
+		      result = ASN1_MEM_ERROR;
+		      goto cleanup;
 		    }
 
 		  if (!(strcmp (currentName, elementName)))
@@ -2095,11 +2187,15 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 
   if (counter > len)
     {
-      asn1_delete_structure (structure);
-      return ASN1_DER_ERROR;
+      result = ASN1_DER_ERROR;
+      goto cleanup;
     }
 
   return ASN1_SUCCESS;
+
+cleanup:
+  asn1_delete_structure (structure);
+  return result;
 }
 
 /**
@@ -2273,7 +2369,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2281,7 +2377,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_OBJECT_ID:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len2 + len3;
@@ -2289,7 +2385,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_TIME:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len2 + len3;
@@ -2305,7 +2401,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2313,7 +2409,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der (der + counter, len - counter, &len3);
+		asn1_get_length_der_checked (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2324,7 +2420,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der (der + counter, len - counter, &len2);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    return ASN1_DER_ERROR;
 		  counter += len2;
@@ -2345,7 +2441,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der (der + counter, len - counter, &len2);
+		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    return ASN1_DER_ERROR;
 		  counter += len2;
@@ -2376,7 +2472,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 		return ASN1_DER_ERROR;
 
 	      len4 =
-		asn1_get_length_der (der + counter + len2,
+		asn1_get_length_der_checked (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
 		return ASN1_DER_ERROR;
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index 289fb57..ac9fafe 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -261,14 +261,14 @@ extern "C"
 		      int *ret_len, unsigned char *str,
 		      int str_size, int *bit_len);
 
-  extern ASN1_API signed long
+  extern ASN1_API int
     asn1_get_length_der (const unsigned char *der, int der_len, int *len);
 
-  extern ASN1_API signed long
+  extern ASN1_API int
     asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
 
   extern ASN1_API void
-    asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len);
+    asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len);
 
   /* Other utility functions. */
 


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 14:34:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7WYD-0004PT-4s
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:34:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54794)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WYA-0004Ol-3T
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:34:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WXt-0005m6-Ix
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:34:21 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37118)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WXt-0005m1-FS
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 14:34:05 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7WXs-0000XH-HY
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:34:04 +0000
Date: Tue, 13 Mar 2012 18:34:04 +0000
Message-Id: <E1S7WXs-0000XH-HY@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-19-g663a7cc
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 826a8eb8dd5bad46d15b2dd58a54938acd36af71
X-Git-Newrev: 663a7cc1fbe990be12e73c3d034729c79f64817b
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 18:34:23 -0000

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=663a7cc1fbe990be12e73c3d034729c79f64817b

The branch, master has been updated
       via  663a7cc1fbe990be12e73c3d034729c79f64817b (commit)
      from  826a8eb8dd5bad46d15b2dd58a54938acd36af71 (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 663a7cc1fbe990be12e73c3d034729c79f64817b
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 19:40:25 2012 +0100

    documented fix

-----------------------------------------------------------------------

Summary of changes:
 NEWS |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index fae31ed..2195ba9 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ GNU Libtasn1 NEWS                                     -*- outline -*-
 - build: Update gnulib files.
 - API is based on integers instead of long to prevent errors in systems
   where sizeof(int)!=sizeof(long).
+- Corrected DER decoding issue (reported by Matthew Hall).
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]
 - qa: Now builds without compiler warnings with Solaris CC.


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 16:09:33 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7Y2H-0005Of-7b
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:09:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:43489)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y1r-0005NW-DU
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:09:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y1l-0000m9-G1
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:09:06 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:55806)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y1l-0000kX-Bv
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:09:01 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y1k-0002ho-BX
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 20:09:00 +0000
Date: Tue, 13 Mar 2012 20:09:00 +0000
Message-Id: <E1S7Y1k-0002ho-BX@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-21-g2078261
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 663a7cc1fbe990be12e73c3d034729c79f64817b
X-Git-Newrev: 2078261bc07afcc1bb6b4bb64b9eba5039f73814
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 20:09:31 -0000

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=2078261bc07afcc1bb6b4bb64b9eba5039f73814

The branch, master has been updated
       via  2078261bc07afcc1bb6b4bb64b9eba5039f73814 (commit)
       via  1c2c956d151a8abdf8684dff3f9717d77064e126 (commit)
      from  663a7cc1fbe990be12e73c3d034729c79f64817b (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 2078261bc07afcc1bb6b4bb64b9eba5039f73814
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 21:15:21 2012 +0100

    reverted to the old ABI.

commit 1c2c956d151a8abdf8684dff3f9717d77064e126
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 21:15:00 2012 +0100

    reverted to the old ABI.

-----------------------------------------------------------------------

Summary of changes:
 configure.ac   |    4 +-
 lib/coding.c   |    2 +-
 lib/decoding.c |  125 +++++++++++++++++++++++++++++++-------------------------
 lib/libtasn1.h |    6 +-
 4 files changed, 75 insertions(+), 62 deletions(-)

diff --git a/configure.ac b/configure.ac
index 13e0fed..b0d541b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,8 +29,8 @@ AM_SILENT_RULES([yes])
 # Interfaces added:                             AGE++
 # Interfaces removed:                           AGE=0
 AC_SUBST(LT_CURRENT, 4)
-AC_SUBST(LT_REVISION, 0)
-AC_SUBST(LT_AGE, 0)
+AC_SUBST(LT_REVISION, 15)
+AC_SUBST(LT_AGE, 1)
 
 AC_PROG_CC
 gl_EARLY
diff --git a/lib/coding.c b/lib/coding.c
index a1896d5..ab430fc 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -68,7 +68,7 @@ _asn1_error_description_value_not_found (ASN1_TYPE node,
  * The @ans buffer is pre-allocated and must have room for the output.
  **/
 void
-asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len)
+asn1_length_der (unsigned long len, unsigned char *ans, int *ans_len)
 {
   int k;
   unsigned char temp[SIZEOF_UNSIGNED_LONG_INT];
diff --git a/lib/decoding.c b/lib/decoding.c
index 32888a3..57e7b2b 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -45,19 +45,8 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
 
 }
 
-/**
- * asn1_get_length_der:
- * @der: DER data to decode.
- * @der_len: Length of DER data to decode.
- * @len: Output variable containing the length of the DER length field.
- *
- * Extract a length field from DER data.
- *
- * Returns: Return the decoded length value, or -1 on indefinite
- *   length, or -2 when the value was too big.
- **/
-int
-asn1_get_length_der (const unsigned char *der, int der_len, int *len)
+static int
+_asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
   int ans;
   int k, punt;
@@ -117,7 +106,7 @@ asn1_get_length_der_checked (const unsigned char *der, int der_len, int *len)
 {
 int ret, tot;
 
-  ret = asn1_get_length_der(der, der_len, len);
+  ret = _asn1_get_length_der(der, der_len, len);
   if (ret < 0)
     return ret;
   
@@ -130,6 +119,24 @@ int ret, tot;
 }
 
 /**
+ * asn1_get_length_der:
+ * @der: DER data to decode.
+ * @der_len: Length of DER data to decode.
+ * @len: Output variable containing the length of the DER length field.
+ *
+ * Extract a length field from DER data.
+ *
+ * Returns: Return the decoded length value, or -1 on indefinite
+ *   length, -2 when the value was too big or -3 when the value
+ *   and the size of length exceed the @der_len.
+ **/
+long
+asn1_get_length_der (const unsigned char *der, int der_len, int *len)
+{
+  return asn1_get_length_der_checked(der, der_len, len);
+}
+
+/**
  * asn1_get_tag_der:
  * @der: DER data to decode.
  * @der_len: Length of DER data to decode.
@@ -186,6 +193,24 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
   return ASN1_SUCCESS;
 }
 
+static int
+_asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
+{
+  int ret;
+  long err;
+
+  ret = _asn1_get_length_der (ber, ber_len, len);
+  if (ret == -1)
+    {				/* indefinite length method */
+      ret = ber_len;
+      err = _asn1_get_indefinite_length_string (ber + 1, &ret);
+      if (err != ASN1_SUCCESS)
+	return -3;
+    }
+
+  return ret;
+}
+
 /**
  * asn1_get_length_ber:
  * @ber: BER data to decode.
@@ -201,22 +226,10 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
  *
  * Since: 2.0
  **/
-int
+long
 asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
 {
-  int ret;
-  long err;
-
-  ret = asn1_get_length_der (ber, ber_len, len);
-  if (ret == -1)
-    {				/* indefinite length method */
-      ret = ber_len;
-      err = _asn1_get_indefinite_length_string (ber + 1, &ret);
-      if (err != ASN1_SUCCESS)
-	return -3;
-    }
-
-  return ret;
+  return _asn1_get_length_ber(ber, ber_len, len);
 }
 
 /**
@@ -421,7 +434,7 @@ _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
 		  counter += len2;
 
 		  len3 =
-		    asn1_get_length_ber (der + counter, der_len - counter,
+		    _asn1_get_length_ber (der + counter, der_len - counter,
 					 &len2);
 		  if (len3 < 0)
 		    return ASN1_DER_ERROR;
@@ -691,7 +704,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
   if (*(der - 1) & ASN1_CLASS_STRUCTURED)
     {
       tot_len = 0;
-      indefinite = asn1_get_length_der_checked (der, *len, &len3);
+      indefinite = asn1_get_length_der (der, *len, &len3);
       if (indefinite < -1)
 	return ASN1_DER_ERROR;
 
@@ -720,7 +733,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
 
 	  counter++;
 
-	  len2 = asn1_get_length_der_checked (der + counter, *len - counter, &len3);
+	  len2 = asn1_get_length_der (der + counter, *len - counter, &len3);
 	  if (len2 <= 0)
 	    return ASN1_DER_ERROR;
 
@@ -749,7 +762,7 @@ _asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
     }
   else
     {				/* NOT STRUCTURED */
-      len2 = asn1_get_length_der_checked (der, *len, &len3);
+      len2 = asn1_get_length_der (der, *len, &len3);
       if (len2 < 0)
 	return ASN1_DER_ERROR;
       if (node)
@@ -1054,7 +1067,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1102,7 +1115,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1115,7 +1128,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1162,7 +1175,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
+		    asn1_get_length_der (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1247,7 +1260,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      else
 		{		/* move==DOWN || move==RIGHT */
 		  len3 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
+		    asn1_get_length_der (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1294,7 +1307,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		  goto cleanup;
                 }
 	      len4 =
-		asn1_get_length_der_checked (der + counter + len2,
+		asn1_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
 	        {
@@ -1680,7 +1693,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1722,7 +1735,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		    asn1_get_length_der (der + counter, len - counter, &len3);
 		  if (len2 < 0)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1753,7 +1766,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      else
 		{
 		  len2 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		    asn1_get_length_der (der + counter, len - counter, &len3);
 		  if (len2 < 0)
 		    {
 		      result = ASN1_DER_ERROR;
@@ -1784,7 +1797,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1808,7 +1821,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 	        {
 		  result = ASN1_DER_ERROR;
@@ -1861,7 +1874,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der_checked (der + counter, len - counter,
+			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 		        {
@@ -1874,7 +1887,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  else
 		    {		/*  state==SAME_BRANCH or state==FOUND */
 		      len3 =
-			asn1_get_length_der_checked (der + counter, len - counter,
+			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 		        {
@@ -1944,7 +1957,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  if (state == OTHER_BRANCH)
 		    {
 		      len3 =
-			asn1_get_length_der_checked (der + counter, len - counter,
+			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 		        {
@@ -1957,7 +1970,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		  else
 		    {		/* state==FOUND or state==SAME_BRANCH */
 		      len3 =
-			asn1_get_length_der_checked (der + counter, len - counter,
+			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
 		        {
@@ -2001,7 +2014,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
                 }
 
 	      len4 =
-		asn1_get_length_der_checked (der + counter + len2,
+		asn1_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
 	        {
@@ -2369,7 +2382,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	    case TYPE_INTEGER:
 	    case TYPE_ENUMERATED:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2377,7 +2390,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_OBJECT_ID:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len2 + len3;
@@ -2385,7 +2398,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_TIME:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len2 + len3;
@@ -2401,7 +2414,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_GENERALSTRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2409,7 +2422,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      break;
 	    case TYPE_BIT_STRING:
 	      len2 =
-		asn1_get_length_der_checked (der + counter, len - counter, &len3);
+		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
 		return ASN1_DER_ERROR;
 	      counter += len3 + len2;
@@ -2420,7 +2433,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
+		    asn1_get_length_der (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    return ASN1_DER_ERROR;
 		  counter += len2;
@@ -2441,7 +2454,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 	      if (move != UP)
 		{
 		  len3 =
-		    asn1_get_length_der_checked (der + counter, len - counter, &len2);
+		    asn1_get_length_der (der + counter, len - counter, &len2);
 		  if (len3 < -1)
 		    return ASN1_DER_ERROR;
 		  counter += len2;
@@ -2472,7 +2485,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
 		return ASN1_DER_ERROR;
 
 	      len4 =
-		asn1_get_length_der_checked (der + counter + len2,
+		asn1_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
 		return ASN1_DER_ERROR;
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index ac9fafe..ed8ba87 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -261,14 +261,14 @@ extern "C"
 		      int *ret_len, unsigned char *str,
 		      int str_size, int *bit_len);
 
-  extern ASN1_API int
+  extern ASN1_API long
     asn1_get_length_der (const unsigned char *der, int der_len, int *len);
 
-  extern ASN1_API int
+  extern ASN1_API long
     asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
 
   extern ASN1_API void
-    asn1_length_der (unsigned int len, unsigned char *ans, int *ans_len);
+    asn1_length_der (unsigned long len, unsigned char *ans, int *ans_len);
 
   /* Other utility functions. */
 


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 16:12:27 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7Y55-0006J5-OK
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:12:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44094)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y4f-0005bq-Qu
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:12:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y4d-0001Pg-0m
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:12:01 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:56632)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y4c-0001Pc-Tx
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 16:11:58 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7Y4c-0003Q4-DY
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 20:11:58 +0000
Date: Tue, 13 Mar 2012 20:11:58 +0000
Message-Id: <E1S7Y4c-0003Q4-DY@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-22-ga525a18
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 2078261bc07afcc1bb6b4bb64b9eba5039f73814
X-Git-Newrev: a525a18a080b8d2a5ae0c6b09bdae1d25e684a77
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 20:12:26 -0000

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=a525a18a080b8d2a5ae0c6b09bdae1d25e684a77

The branch, master has been updated
       via  a525a18a080b8d2a5ae0c6b09bdae1d25e684a77 (commit)
      from  2078261bc07afcc1bb6b4bb64b9eba5039f73814 (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 a525a18a080b8d2a5ae0c6b09bdae1d25e684a77
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 21:18:20 2012 +0100

    the change was reverted

-----------------------------------------------------------------------

Summary of changes:
 NEWS |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 2195ba9..a69be2c 100644
--- a/NEWS
+++ b/NEWS
@@ -3,8 +3,6 @@ GNU Libtasn1 NEWS                                     -*- outline -*-
 * Noteworthy changes in release 2.12 (????-??-??) [?]
 - Cleanup license headers.
 - build: Update gnulib files.
-- API is based on integers instead of long to prevent errors in systems
-  where sizeof(int)!=sizeof(long).
 - Corrected DER decoding issue (reported by Matthew Hall).
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 17:31:05 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7ZJB-0000xH-Ce
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 17:31:05 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52947)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7ZJ8-0000wF-4W
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 17:31:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7ZJ1-0000mX-Oz
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 17:31:01 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:56864)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7ZJ1-0000mF-MY
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 17:30:55 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7ZJ0-0006OY-S4
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 21:30:55 +0000
Date: Tue, 13 Mar 2012 21:30:54 +0000
Message-Id: <E1S7ZJ0-0006OY-S4@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-23-ge9e074f
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a525a18a080b8d2a5ae0c6b09bdae1d25e684a77
X-Git-Newrev: e9e074f518658c46dcc45c9305c7ff4f8eade302
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 21:31:03 -0000

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=e9e074f518658c46dcc45c9305c7ff4f8eade302

The branch, master has been updated
       via  e9e074f518658c46dcc45c9305c7ff4f8eade302 (commit)
      from  a525a18a080b8d2a5ae0c6b09bdae1d25e684a77 (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 e9e074f518658c46dcc45c9305c7ff4f8eade302
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Tue Mar 13 22:37:16 2012 +0100

    for some reason the tot < 0 test wasn't successful on negative results. Replaced with tot < ret.

-----------------------------------------------------------------------

Summary of changes:
 lib/decoding.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/decoding.c b/lib/decoding.c
index 57e7b2b..9cd5a34 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -111,8 +111,8 @@ int ret, tot;
     return ret;
   
   tot = ret + *len;
-  
-  if (tot < 0 || tot > der_len)
+
+  if (tot < ret || tot > der_len)
     return -3;
 
   return ret;


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Tue Mar 13 18:47:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7aVQ-0003Ay-BJ
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:47:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49362)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7aVN-0003AM-Es
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:47:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7aVL-0000qo-8S
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:47:45 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:39319)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7aVL-0000qk-4X
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 18:47:43 -0400
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7aVI-0002lU-QW
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 22:47:42 +0000
Date: Tue, 13 Mar 2012 22:47:40 +0000
Message-Id: <E1S7aVI-0002lU-QW@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-24-g4b1805a
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: e9e074f518658c46dcc45c9305c7ff4f8eade302
X-Git-Newrev: 4b1805a021aa9abe74ba775aaaff84fc21ea07e9
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 22:47:47 -0000

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 <simon@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


From MAILER-DAEMON Tue Mar 13 19:50:58 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7bUY-00027h-2j
	for mharc-libtasn1-commit@gnu.org; Tue, 13 Mar 2012 19:50:58 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35748)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7bUU-00027E-Iy
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 19:50:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7bUR-0005SO-Vy
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 19:50:54 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:49702)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7bUR-0005SI-S0
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 19:50:51 -0400
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7bUQ-0002Kg-Ud
	for libtasn1-commit@gnu.org; Tue, 13 Mar 2012 23:50:51 +0000
Date: Tue, 13 Mar 2012 23:50:51 +0000
Message-Id: <E1S7bUQ-0002Kg-Ud@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-25-g6e534bf
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4b1805a021aa9abe74ba775aaaff84fc21ea07e9
X-Git-Newrev: 6e534bf4fb3144be51c928ed3efcf9c36055c9c7
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2012 23:50:56 -0000

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=6e534bf4fb3144be51c928ed3efcf9c36055c9c7

The branch, master has been updated
       via  6e534bf4fb3144be51c928ed3efcf9c36055c9c7 (commit)
      from  4b1805a021aa9abe74ba775aaaff84fc21ea07e9 (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 6e534bf4fb3144be51c928ed3efcf9c36055c9c7
Author: Simon Josefsson <simon@josefsson.org>
Date:   Wed Mar 14 00:20:16 2012 +0100

    Simplify overflow check.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore            |    2 +
 lib/coding.c          |    2 +-
 lib/decoding.c        |  106 ++++++++++++++++---------------------------------
 lib/libtasn1.h        |    6 +-
 tests/Test_overflow.c |   70 +++++++++++++++++++++++++++------
 5 files changed, 98 insertions(+), 88 deletions(-)

diff --git a/.gitignore b/.gitignore
index f5c283c..9c56412 100644
--- a/.gitignore
+++ b/.gitignore
@@ -182,6 +182,8 @@ tests/Test_errors
 tests/Test_errors.o
 tests/Test_indefinite
 tests/Test_indefinite.o
+tests/Test_overflow
+tests/Test_overflow.o
 tests/Test_parser
 tests/Test_parser.o
 tests/Test_parser_ERROR.asn
diff --git a/lib/coding.c b/lib/coding.c
index ab430fc..8b72eba 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -68,7 +68,7 @@ _asn1_error_description_value_not_found (ASN1_TYPE node,
  * The @ans buffer is pre-allocated and must have room for the output.
  **/
 void
-asn1_length_der (unsigned long len, unsigned char *ans, int *ans_len)
+asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len)
 {
   int k;
   unsigned char temp[SIZEOF_UNSIGNED_LONG_INT];
diff --git a/lib/decoding.c b/lib/decoding.c
index 9cd5a34..968fa96 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -45,8 +45,20 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
 
 }
 
-static int
-_asn1_get_length_der (const unsigned char *der, int der_len, int *len)
+/**
+ * asn1_get_length_der:
+ * @der: DER data to decode.
+ * @der_len: Length of DER data to decode.
+ * @len: Output variable containing the length of the DER length field.
+ *
+ * Extract a length field from DER data.
+ *
+ * Returns: Return the decoded length value, or -1 on indefinite
+ *   length, or -2 when the value was too big to fit in a int, or -4
+ *   when the decoded length value plus @len would exceed @der_len.
+ **/
+signed long
+asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
   int ans;
   int k, punt;
@@ -71,7 +83,7 @@ _asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 	  ans = 0;
 	  while (punt <= k && punt < der_len)
 	    {
-	      unsigned long last = ans;
+	      int last = ans;
 
 	      ans = ans * 256 + der[punt++];
 	      if (ans < last)
@@ -81,61 +93,17 @@ _asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 	}
       else
 	{			/* indefinite length method */
-	  ans = -1;
+	  *len = punt;
+	  return -1;
 	}
 
       *len = punt;
+      if (ans + *len < ans || ans + *len > der_len)
+	return -4;
       return ans;
     }
 }
 
-/*-
- * asn1_get_length_der_checked:
- * @der: DER data to decode.
- * @der_len: Length of DER data to decode.
- * @len: Output variable containing the length of the DER length field.
- *
- * Extract a length field from DER data.
- *
- * Returns: Return the decoded length value, or -1 on indefinite
- *   length, -2 when the value was too big or -3 when the value
- *   and the size of length exceed the @der_len.
- -*/
-static int
-asn1_get_length_der_checked (const unsigned char *der, int der_len, int *len)
-{
-int ret, tot;
-
-  ret = _asn1_get_length_der(der, der_len, len);
-  if (ret < 0)
-    return ret;
-  
-  tot = ret + *len;
-
-  if (tot < ret || tot > der_len)
-    return -3;
-
-  return ret;
-}
-
-/**
- * asn1_get_length_der:
- * @der: DER data to decode.
- * @der_len: Length of DER data to decode.
- * @len: Output variable containing the length of the DER length field.
- *
- * Extract a length field from DER data.
- *
- * Returns: Return the decoded length value, or -1 on indefinite
- *   length, -2 when the value was too big or -3 when the value
- *   and the size of length exceed the @der_len.
- **/
-long
-asn1_get_length_der (const unsigned char *der, int der_len, int *len)
-{
-  return asn1_get_length_der_checked(der, der_len, len);
-}
-
 /**
  * asn1_get_tag_der:
  * @der: DER data to decode.
@@ -193,24 +161,6 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
   return ASN1_SUCCESS;
 }
 
-static int
-_asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
-{
-  int ret;
-  long err;
-
-  ret = _asn1_get_length_der (ber, ber_len, len);
-  if (ret == -1)
-    {				/* indefinite length method */
-      ret = ber_len;
-      err = _asn1_get_indefinite_length_string (ber + 1, &ret);
-      if (err != ASN1_SUCCESS)
-	return -3;
-    }
-
-  return ret;
-}
-
 /**
  * asn1_get_length_ber:
  * @ber: BER data to decode.
@@ -226,10 +176,22 @@ _asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
  *
  * Since: 2.0
  **/
-long
+signed long
 asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len)
 {
-  return _asn1_get_length_ber(ber, ber_len, len);
+  int ret;
+  long err;
+
+  ret = asn1_get_length_der (ber, ber_len, len);
+  if (ret == -1)
+    {				/* indefinite length method */
+      ret = ber_len;
+      err = _asn1_get_indefinite_length_string (ber + 1, &ret);
+      if (err != ASN1_SUCCESS)
+	return -3;
+    }
+
+  return ret;
 }
 
 /**
@@ -434,7 +396,7 @@ _asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
 		  counter += len2;
 
 		  len3 =
-		    _asn1_get_length_ber (der + counter, der_len - counter,
+		    asn1_get_length_ber (der + counter, der_len - counter,
 					 &len2);
 		  if (len3 < 0)
 		    return ASN1_DER_ERROR;
diff --git a/lib/libtasn1.h b/lib/libtasn1.h
index ed8ba87..289fb57 100644
--- a/lib/libtasn1.h
+++ b/lib/libtasn1.h
@@ -261,14 +261,14 @@ extern "C"
 		      int *ret_len, unsigned char *str,
 		      int str_size, int *bit_len);
 
-  extern ASN1_API long
+  extern ASN1_API signed long
     asn1_get_length_der (const unsigned char *der, int der_len, int *len);
 
-  extern ASN1_API long
+  extern ASN1_API signed long
     asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len);
 
   extern ASN1_API void
-    asn1_length_der (unsigned long len, unsigned char *ans, int *ans_len);
+    asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len);
 
   /* Other utility functions. */
 
diff --git a/tests/Test_overflow.c b/tests/Test_overflow.c
index 383f723..2136899 100644
--- a/tests/Test_overflow.c
+++ b/tests/Test_overflow.c
@@ -23,25 +23,71 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <limits.h>
 
 #include "libtasn1.h"
 
 int
 main (void)
 {
-  unsigned char der[] = "\x84\x7F\xFF\xFF\xFF";
-  long l;
-  int len;
-
-  l = asn1_get_length_der (der, sizeof der, &len);
-
-  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;
+  /* Test that values larger than long are rejected.  This has worked
+     fine with all versions of libtasn1. */
+  {
+    unsigned char der[] = "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
+    long l;
+    int len;
+
+    l = asn1_get_length_der (der, sizeof der, &len);
+
+    if (l == -2L)
+      puts ("OK: asn1_get_length_der bignum");
+    else
+      {
+	printf ("ERROR: asn1_get_length_der bignum (l %ld len %d)\n", l, len);
+	return 1;
+      }
+  }
+
+  /* Test that values larger than int but smaller than long are
+     rejected.  This limitation was introduced with libtasn1 2.12. */
+  if (LONG_MAX > INT_MAX)
+    {
+      unsigned long num = ((long) UINT_MAX) << 2;
+      unsigned char der[20];
+      int der_len;
+      long l;
+      int len;
+
+      asn1_length_der (num, der, &der_len);
+
+      l = asn1_get_length_der (der, der_len, &len);
+
+      if (l == -2L)
+	puts ("OK: asn1_get_length_der intnum");
+      else
+	{
+	  printf ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l, len);
+	  return 1;
+	}
     }
 
+  /* Test that values larger than would fit in the input string are
+     rejected.  This problem was fixed in libtasn1 2.12. */
+  {
+    unsigned char der[] = "\x84\x7F\xFF\xFF\xFF";
+    long l;
+    int len;
+
+    l = asn1_get_length_der (der, sizeof der, &len);
+
+    if (l == -4L)
+      puts ("OK: asn1_get_length_der overflow");
+    else
+      {
+	printf ("ERROR: asn1_get_length_der overflow (l %ld len %d)\n", l, len);
+	return 1;
+      }
+  }
+
   return 0;
 }


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Wed Mar 14 04:24:51 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S7jVr-0003mL-SF
	for mharc-libtasn1-commit@gnu.org; Wed, 14 Mar 2012 04:24:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47837)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7jVl-0003lU-Nh
	for libtasn1-commit@gnu.org; Wed, 14 Mar 2012 04:24:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7jVi-0000sF-AN
	for libtasn1-commit@gnu.org; Wed, 14 Mar 2012 04:24:45 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:43210)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7jVi-0000s9-5h
	for libtasn1-commit@gnu.org; Wed, 14 Mar 2012 04:24:42 -0400
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S7jVh-0006wE-If
	for libtasn1-commit@gnu.org; Wed, 14 Mar 2012 08:24:41 +0000
Date: Wed, 14 Mar 2012 08:24:41 +0000
Message-Id: <E1S7jVh-0006wE-If@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-27-g41faef1
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6e534bf4fb3144be51c928ed3efcf9c36055c9c7
X-Git-Newrev: 41faef165ea348b50f4deb625de0479ae3a05126
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Mar 2012 08:24:50 -0000

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=41faef165ea348b50f4deb625de0479ae3a05126

The branch, master has been updated
       via  41faef165ea348b50f4deb625de0479ae3a05126 (commit)
       via  2a4bf1e9958fd111434061062260f9777b29fa39 (commit)
      from  6e534bf4fb3144be51c928ed3efcf9c36055c9c7 (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 41faef165ea348b50f4deb625de0479ae3a05126
Author: Simon Josefsson <simon@josefsson.org>
Date:   Wed Mar 14 09:24:35 2012 +0100

    Give credit.

commit 2a4bf1e9958fd111434061062260f9777b29fa39
Author: Simon Josefsson <simon@josefsson.org>
Date:   Wed Mar 14 09:24:02 2012 +0100

    Mention severity.

-----------------------------------------------------------------------

Summary of changes:
 NEWS   |    2 ++
 THANKS |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 188448d..2037055 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ GNU Libtasn1 NEWS                                     -*- outline -*-
 - build: Update gnulib files.
 - Corrected DER decoding issue (reported by Matthew Hall).
   Added self check to detect the problem, see tests/Test_overflow.c.
+  This problem can lead to at least remotely triggered crashes, see
+  further analysis on the libtasn1 mailing list.
 
 * Noteworthy changes in release 2.11 (2011-11-25) [stable]
 - qa: Now builds without compiler warnings with Solaris CC.
diff --git a/THANKS b/THANKS
index f52021a..2b78d11 100644
--- a/THANKS
+++ b/THANKS
@@ -18,6 +18,7 @@ Didier Godefroy         <dg@ulysium.net>
 Andreas Metzler         <ametzler@downhill.at.eu.org>
 Ludovic Courtès         <ludo@gnu.org>
 Jeffrey Walton          <noloader@gmail.com>
+Matthew Hall            <mhall@mhcomputing.net>
 
 ----------------------------------------------------------------------
 Copyright (C) 2002-2012 Free Software Foundation, Inc.


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Mon Mar 19 05:47:17 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S9ZBN-0002Qn-NC
	for mharc-libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38274)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZBE-0002Qb-Aw
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZBC-00053v-DT
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:07 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:51891)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZBC-00053o-AF
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:06 -0400
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZBC-0008Uz-AW
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 09:47:06 +0000
Date: Mon, 19 Mar 2012 09:47:06 +0000
Message-Id: <E1S9ZBC-0008Uz-AW@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 annotated tag, libtasn1_2_12,
	created. libtasn1_2_12
X-Git-Refname: refs/tags/libtasn1_2_12
X-Git-Reftype: annotated tag
X-Git-Oldrev: 0000000000000000000000000000000000000000
X-Git-Newrev: fcc064355c88420c845b48ad431daa81c2a01a88
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Mar 2012 09:47:16 -0000

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=fcc064355c88420c845b48ad431daa81c2a01a88

The annotated tag, libtasn1_2_12 has been created
        at  fcc064355c88420c845b48ad431daa81c2a01a88 (tag)
   tagging  95ed3fdda525edd37ce0ea8eaf255a9b1563a25b (commit)
  replaces  libtasn1_2_11
 tagged by  Simon Josefsson
        on  Mon Mar 19 10:46:50 2012 +0100

- Log -----------------------------------------------------------------
2.12
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iO4EAAECADgFAk9nAIoxFIAAAAAAFQATcGthLWFkZHJlc3NAZ251cGcub3Jnc2lt
b25Aam9zZWZzc29uLm9yZwAKCRDtoh6UtWVxb0xtBPwPTozy6K+ZIRYRqK9v+n2x
NoQCXTsV91c7wPQ+woD9hIHhXaA3s+UbwcQMuv6LKC2OxBQxZhBdFbu8cA2R1fRe
+DHSPgHuqqg92VG7J1EEQsFGr10CfYwCJ1wJqJs685JRe2iRBcjSzrMX02AXx3sc
GMDZYWevAnowYJn0ffRvuJpaEQxYgvUuy1xjQ8ScM0E87RlAa59h/0VtKCPPpbRe
=xSwQ
-----END PGP SIGNATURE-----

Nikos Mavrogiannopoulos (14):
      better cleanup in decoding.
      updated to bison 2.5
      asn1_get_length_der() may handle up to signed long values.
      API is based on integers instead of long to prevent errors in systems where sizeof(int)!=sizeof(long)
      cleanups in asn1_der_decoding_element().
      Added asn1_get_length_der_checked() to put some of the common checks in a single function.
      bumped shared lib version
      int is signed.
      check for overflows
      documented fix
      reverted to the old ABI.
      reverted to the old ABI.
      the change was reverted
      for some reason the tot < 0 test wasn't successful on negative results. Replaced with tot < ret.

Simon Josefsson (17):
      Update for 2.10.
      Update for 2.11.
      Bump versions.
      Drop unnecessary configure.ac checks.
      Update gnulib files.
      Update gnulib files.
      Bump copyright years.
      Update gnulib files.
      Add.
      Add self-check.
      Simplify overflow check.
      Mention severity.
      Give credit.
      Update gnulib files.
      Indent code.
      Version 2.12.
      Generated.

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Mon Mar 19 05:47:37 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1S9ZBh-0002RD-RS
	for mharc-libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38281)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZBH-0002Qc-1C
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZB8-00053Z-CE
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:10 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:51881)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZB8-00053V-7y
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 05:47:02 -0400
Received: from jas by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1S9ZB7-0008TZ-LK
	for libtasn1-commit@gnu.org; Mon, 19 Mar 2012 09:47:01 +0000
Date: Mon, 19 Mar 2012 09:47:01 +0000
Message-Id: <E1S9ZB7-0008TZ-LK@vcs.savannah.gnu.org>
From: "Simon Josefsson" <simon@josefsson.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_11-31-g95ed3fd
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 41faef165ea348b50f4deb625de0479ae3a05126
X-Git-Newrev: 95ed3fdda525edd37ce0ea8eaf255a9b1563a25b
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Mar 2012 09:47:37 -0000

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=95ed3fdda525edd37ce0ea8eaf255a9b1563a25b

The branch, master has been updated
       via  95ed3fdda525edd37ce0ea8eaf255a9b1563a25b (commit)
       via  fb467377da305fb0afd5326e32f5654dfd816705 (commit)
       via  e4c605d4c575d9f56f44970fdf3bee567b8fac18 (commit)
       via  8ab3a5231ef83834a17818edf2f2b1911b02bb05 (commit)
      from  41faef165ea348b50f4deb625de0479ae3a05126 (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 95ed3fdda525edd37ce0ea8eaf255a9b1563a25b
Author: Simon Josefsson <simon@josefsson.org>
Date:   Mon Mar 19 10:46:50 2012 +0100

    Generated.

commit fb467377da305fb0afd5326e32f5654dfd816705
Author: Simon Josefsson <simon@josefsson.org>
Date:   Mon Mar 19 10:39:00 2012 +0100

    Version 2.12.

commit e4c605d4c575d9f56f44970fdf3bee567b8fac18
Author: Simon Josefsson <simon@josefsson.org>
Date:   Mon Mar 19 10:14:19 2012 +0100

    Indent code.

commit 8ab3a5231ef83834a17818edf2f2b1911b02bb05
Author: Simon Josefsson <simon@josefsson.org>
Date:   Mon Mar 19 10:12:41 2012 +0100

    Update gnulib files.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                     |  199 ++++++++++++++++++++++++++++++++++++++++-
 NEWS                          |    2 +-
 build-aux/gnupload            |    2 +-
 examples/CertificateExample.c |    8 +-
 lib/coding.c                  |    4 +-
 lib/decoding.c                |   92 ++++++++++----------
 lib/errors.c                  |    2 +-
 lib/int.h                     |    4 +-
 lib/parser_aux.c              |    3 +-
 lib/version.c                 |    2 +-
 maint.mk                      |    3 +-
 src/asn1Coding.c              |    7 +-
 src/asn1Decoding.c            |    4 +-
 src/asn1Parser.c              |    4 +-
 tests/Test_overflow.c         |    6 +-
 tests/Test_simple.c           |   83 +++++++++---------
 16 files changed, 312 insertions(+), 113 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 21e9088..b8c15c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,199 @@
+2012-03-19  Simon Josefsson <simon@josefsson.org>
+
+	* NEWS: Version 2.12.
+
+2012-03-19  Simon Josefsson <simon@josefsson.org>
+
+	* examples/CertificateExample.c, lib/coding.c, lib/decoding.c,
+	lib/errors.c, lib/int.h, lib/parser_aux.c, lib/version.c,
+	src/asn1Coding.c, src/asn1Decoding.c, src/asn1Parser.c,
+	tests/Test_overflow.c, tests/Test_simple.c: Indent code.
+
+2012-03-19  Simon Josefsson <simon@josefsson.org>
+
+	* build-aux/gnupload, maint.mk: Update gnulib files.
+
+2012-03-14  Simon Josefsson <simon@josefsson.org>
+
+	* THANKS: Give credit.
+
+2012-03-14  Simon Josefsson <simon@josefsson.org>
+
+	* NEWS: Mention severity.
+
+2012-03-14  Simon Josefsson <simon@josefsson.org>
+
+	* .gitignore, lib/coding.c, lib/decoding.c, lib/libtasn1.h,
+	tests/Test_overflow.c: Simplify overflow check.
+
+2012-03-13  Simon Josefsson <simon@josefsson.org>
+
+	* NEWS, tests/Makefile.am, tests/Test_overflow.c: Add self-check.
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: for some reason the tot < 0 test wasn't successful
+	on negative results. Replaced with tot < ret.
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* NEWS: the change was reverted
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* configure.ac: reverted to the old ABI.
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/coding.c, lib/decoding.c, lib/libtasn1.h: reverted to the old
+	ABI.
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* NEWS: documented fix
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: check for overflows
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c, lib/libtasn1.h: int is signed.
+
+2012-03-13  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* configure.ac: bumped shared lib version
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: Added asn1_get_length_der_checked() to put some of
+	the common checks in a single function.
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: cleanups in asn1_der_decoding_element().
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* NEWS, lib/coding.c, lib/decoding.c, lib/libtasn1.h: API is based
+	on integers instead of long to prevent errors in systems where
+	sizeof(int)!=sizeof(long)
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: asn1_get_length_der() may handle up to signed long
+	values.
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/ASN1.c: updated to bison 2.5
+
+2012-03-04  Nikos Mavrogiannopoulos <nmav@gnutls.org>
+
+	* lib/decoding.c: better cleanup in decoding.
+
+2012-03-09  Simon Josefsson <simon@josefsson.org>
+
+	* NEWS: Add.
+
+2012-03-07  Simon Josefsson <simon@josefsson.org>
+
+	* GNUmakefile, NEWS, build-aux/update-copyright, gl/errno.in.h,
+	gl/gettext.h, gl/lseek.c, gl/malloc.c, gl/msvc-inval.c,
+	gl/msvc-inval.h, gl/msvc-nothrow.c, gl/msvc-nothrow.h,
+	gl/read-file.c, gl/read-file.h, gl/stdarg.in.h, gl/stddef.in.h,
+	gl/stdint.in.h, gl/stdio-impl.h, gl/stdio.in.h, gl/sys_stat.in.h,
+	gl/time.in.h, gl/unistd.in.h, gl/version-etc.h,
+	lib/gllib/stddef.in.h, lib/gllib/stdint.in.h,
+	lib/gllib/string.in.h, lib/gllib/strverscmp.c, maint.mk: Update
+	gnulib files.
+
+2012-01-23  Simon Josefsson <simon@josefsson.org>
+
+	* .clcopying, AUTHORS, Makefile.am, NEWS, README, README-alpha,
+	THANKS, cfg.mk, configure.ac, doc/Makefile.am, doc/TODO,
+	doc/cyclo/Makefile.am, doc/libtasn1.texi,
+	examples/CertificateExample.c, examples/CrlExample.c,
+	examples/Makefile.am, examples/asn1Coding_test.asn,
+	examples/pkix.asn, lib/ASN1.y, lib/Makefile.am, lib/coding.c,
+	lib/decoding.c, lib/element.c, lib/element.h, lib/errors.c,
+	lib/gstr.c, lib/gstr.h, lib/int.h, lib/libtasn1.h,
+	lib/libtasn1.map, lib/libtasn1.pc.in, lib/parser_aux.c,
+	lib/parser_aux.h, lib/structure.c, lib/structure.h, lib/version.c,
+	m4/update-header-version.m4, src/Makefile.am, src/asn1Coding.c,
+	src/asn1Decoding.c, src/asn1Parser.c, tests/Makefile.am,
+	tests/Test_encoding.asn, tests/Test_encoding.c,
+	tests/Test_errors.c, tests/Test_indefinite.c,
+	tests/Test_parser.asn, tests/Test_parser.c, tests/Test_simple.c,
+	tests/Test_tree.asn, tests/Test_tree.c, tests/crlf, tests/pkix.asn,
+	tests/threadsafety: Bump copyright years.
+
+2012-01-23  Simon Josefsson <simon@josefsson.org>
+
+	* GNUmakefile, build-aux/gnupload, build-aux/pmccabe.css,
+	build-aux/pmccabe2html, build-aux/snippet/arg-nonnull.h,
+	build-aux/snippet/c++defs.h, build-aux/snippet/warn-on-use.h,
+	build-aux/update-copyright, build-aux/useless-if-before-free,
+	build-aux/vc-list-files, doc/fdl-1.3.texi, doc/gendocs_template,
+	gl/Makefile.am, gl/errno.in.h, gl/fstat.c, gl/ftell.c, gl/ftello.c,
+	gl/getopt.c, gl/getopt.in.h, gl/getopt1.c, gl/getopt_int.h,
+	gl/gettext.h, gl/lseek.c, gl/m4/00gnulib.m4, gl/m4/autobuild.m4,
+	gl/m4/errno_h.m4, gl/m4/extensions.m4, gl/m4/fseeko.m4,
+	gl/m4/fstat.m4, gl/m4/ftell.m4, gl/m4/ftello.m4, gl/m4/getopt.m4,
+	gl/m4/gnulib-cache.m4, gl/m4/gnulib-common.m4,
+	gl/m4/gnulib-comp.m4, gl/m4/gnulib-tool.m4, gl/m4/include_next.m4,
+	gl/m4/largefile.m4, gl/m4/longlong.m4, gl/m4/lseek.m4,
+	gl/m4/malloc.m4, gl/m4/manywarnings.m4, gl/m4/msvc-inval.m4,
+	gl/m4/msvc-nothrow.m4, gl/m4/multiarch.m4, gl/m4/nocrash.m4,
+	gl/m4/read-file.m4, gl/m4/realloc.m4, gl/m4/ssize_t.m4,
+	gl/m4/stdarg.m4, gl/m4/stddef_h.m4, gl/m4/stdint.m4,
+	gl/m4/stdio_h.m4, gl/m4/stdlib_h.m4, gl/m4/sys_stat_h.m4,
+	gl/m4/time_h.m4, gl/m4/unistd_h.m4, gl/m4/valgrind-tests.m4,
+	gl/m4/version-etc.m4, gl/m4/warn-on-use.m4, gl/m4/warnings.m4,
+	gl/m4/wchar_t.m4, gl/malloc.c, gl/msvc-inval.c, gl/msvc-inval.h,
+	gl/msvc-nothrow.c, gl/msvc-nothrow.h, gl/progname.c, gl/progname.h,
+	gl/read-file.c, gl/read-file.h, gl/realloc.c, gl/stdarg.in.h,
+	gl/stddef.in.h, gl/stdint.in.h, gl/stdio-impl.h, gl/stdio.in.h,
+	gl/stdlib.in.h, gl/sys_stat.in.h, gl/time.in.h, gl/unistd.in.h,
+	gl/version-etc-fsf.c, gl/version-etc.c, gl/version-etc.h,
+	lib/gllib/Makefile.am, lib/gllib/dummy.c, lib/gllib/stddef.in.h,
+	lib/gllib/stdint.in.h, lib/gllib/string.in.h,
+	lib/gllib/strverscmp.c, lib/glm4/00gnulib.m4,
+	lib/glm4/extensions.m4, lib/glm4/gnulib-cache.m4,
+	lib/glm4/gnulib-common.m4, lib/glm4/gnulib-comp.m4,
+	lib/glm4/gnulib-tool.m4, lib/glm4/include_next.m4,
+	lib/glm4/ld-version-script.m4, lib/glm4/longlong.m4,
+	lib/glm4/multiarch.m4, lib/glm4/stddef_h.m4, lib/glm4/stdint.m4,
+	lib/glm4/string_h.m4, lib/glm4/strverscmp.m4,
+	lib/glm4/visibility.m4, lib/glm4/warn-on-use.m4,
+	lib/glm4/wchar_t.m4, maint.mk: Update gnulib files.
+
+2011-12-06  Simon Josefsson <simon@josefsson.org>
+
+	* gl/Makefile.am, gl/m4/getopt.m4, gl/m4/gnulib-comp.m4,
+	gl/m4/manywarnings.m4, gl/m4/unistd_h.m4, gl/unistd.in.h, maint.mk: 
+	Update gnulib files.
+
+2011-12-06  Simon Josefsson <simon@josefsson.org>
+
+	* configure.ac: Drop unnecessary configure.ac checks.
+
+2011-12-06  Simon Josefsson <simon@josefsson.org>
+
+	* NEWS, configure.ac, lib/libtasn1.h: Bump versions.
+
+2011-11-25  Simon Josefsson <simon@josefsson.org>
+
+	* doc/announce.txt: Update for 2.11.
+
+2011-11-25  Simon Josefsson <simon@josefsson.org>
+
+	* doc/announce.txt: Update for 2.10.
+
+2011-11-25  Simon Josefsson <simon@josefsson.org>
+
+	* ChangeLog: Generated.
+
 2011-11-25  Simon Josefsson <simon@josefsson.org>
 
 	* NEWS: Version 2.11.
@@ -4264,8 +4460,7 @@
 	* Initial revision
 
 	----------------------------------------------------------------------
-	Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010,
-	2011 Free Software Foundation, Inc.
+	Copyright (C) 2002-2012 Free Software Foundation, Inc.
 	Copying and distribution of this file, with or without modification,
 	are permitted in any medium without royalty provided the copyright
 	notice and this notice are preserved.
diff --git a/NEWS b/NEWS
index 2037055..48c2528 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 GNU Libtasn1 NEWS                                     -*- outline -*-
 
-* Noteworthy changes in release 2.12 (????-??-??) [?]
+* Noteworthy changes in release 2.12 (2012-03-19) [stable]
 - Cleanup license headers.
 - build: Update gnulib files.
 - Corrected DER decoding issue (reported by Matthew Hall).
diff --git a/build-aux/gnupload b/build-aux/gnupload
index eb450a0..40a59d3 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -3,7 +3,7 @@
 
 scriptversion=2012-01-15.15; # UTC
 
-# Copyright (C) 2004-2010, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2012 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/examples/CertificateExample.c b/examples/CertificateExample.c
index 9972467..cd45f97 100644
--- a/examples/CertificateExample.c
+++ b/examples/CertificateExample.c
@@ -447,11 +447,11 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
 		      str, 1);
   result =
     asn1_create_element (cert_def, "PKIX1Implicit88.Dss-Parms", &param);
-  str2 = (const unsigned char *) "\xd4\x38";		/* only an example */
+  str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
   result = asn1_write_value (param, "p", str2, 128);
-  str2 = (const unsigned char *) "\xd4\x38";		/* only an example */
+  str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
   result = asn1_write_value (param, "q", str2, 20);
-  str2 = (const unsigned char *) "\xd4\x38";		/* only an example */
+  str2 = (const unsigned char *) "\xd4\x38";	/* only an example */
   result = asn1_write_value (param, "g", str2, 128);
   *der_len = max_len;
   result = asn1_der_coding (param, "", der, der_len, errorDescription);
@@ -463,7 +463,7 @@ create_certificate (ASN1_TYPE cert_def, unsigned char *der, int *der_len)
 
 
   /* subjectPublicKey */
-  str2 = (const unsigned char *) "\x02\x81";		/* only an example */
+  str2 = (const unsigned char *) "\x02\x81";	/* only an example */
   result =
     asn1_write_value (cert1,
 		      "tbsCertificate.subjectPublicKeyInfo.subjectPublicKey",
diff --git a/lib/coding.c b/lib/coding.c
index 8b72eba..307dd40 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -256,7 +256,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
   char *temp, *n_end, *n_start;
   unsigned char bit7;
   unsigned long val, val1 = 0;
-  int str_len = _asn1_strlen(str);
+  int str_len = _asn1_strlen (str);
 
   max_len = *der_len;
 
@@ -266,7 +266,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
 
   memcpy (temp, str, str_len);
   temp[str_len] = '.';
-  temp[str_len+1] = 0;
+  temp[str_len + 1] = 0;
 
   counter = 0;
   n_start = temp;
diff --git a/lib/decoding.c b/lib/decoding.c
index 968fa96..eaca0d2 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -1031,10 +1031,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
@@ -1045,7 +1045,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		_asn1_get_objectid_der (der + counter, len - counter, &len2,
 					temp, sizeof (temp));
 	      if (result != ASN1_SUCCESS)
-                goto cleanup;
+		goto cleanup;
 
 	      tlen = strlen (temp);
 	      if (tlen > 0)
@@ -1070,7 +1070,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      len3 = len - counter;
 	      result = _asn1_get_octet_string (der + counter, p, &len3);
 	      if (result != ASN1_SUCCESS)
-                goto cleanup;
+		goto cleanup;
 
 	      counter += len3;
 	      move = RIGHT;
@@ -1079,10 +1079,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
@@ -1092,10 +1092,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      _asn1_set_value (p, der + counter, len3 + len2);
 	      counter += len3 + len2;
@@ -1118,10 +1118,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 			    }
 			}
 		      else
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		      counter += 2;
 		    }
 		  else
@@ -1142,7 +1142,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  counter += len2;
 		  if (len3 > 0)
 		    {
@@ -1183,10 +1183,10 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		  if (len2 == -1)
 		    {		/* indefinite length method */
 		      if ((counter + 2) > len)
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 
 		      if ((der[counter]) || der[counter + 1])
 			{
@@ -1227,7 +1227,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  counter += len2;
 		  if (len3)
 		    {
@@ -1258,24 +1258,24 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 	      if (asn1_get_tag_der
 		  (der + counter, len - counter, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
-                {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      if (counter + len2 > len)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 	      len4 =
 		asn1_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 	      if (len4 != -1)
 		{
 		  len2 += len4;
@@ -1311,7 +1311,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
 			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		    }
 		}
 	      move = RIGHT;
@@ -1657,10 +1657,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      if (state == FOUND)
 		{
@@ -1668,7 +1668,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1702,7 +1702,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  len2 += len3;
 		}
 
@@ -1733,7 +1733,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  len2 += len3;
 		}
 
@@ -1761,10 +1761,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      if (state == FOUND)
 		{
@@ -1772,7 +1772,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1785,17 +1785,17 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      len2 =
 		asn1_get_length_der (der + counter, len - counter, &len3);
 	      if (len2 < 0)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 	      if (state == FOUND)
 		{
 		  if (len3 + len2 > len - counter)
 		    {
 		      result = ASN1_DER_ERROR;
 		      goto cleanup;
-                    }
+		    }
 		  _asn1_set_value (p, der + counter, len3 + len2);
 
 		  if (p == nodeFound)
@@ -1839,10 +1839,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		      counter += len2 + len3;
 		      move = RIGHT;
 		    }
@@ -1852,10 +1852,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		      counter += len2;
 		      if (len3 > 0)
 			{
@@ -1922,10 +1922,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		      counter += len2 + len3;
 		      move = RIGHT;
 		    }
@@ -1935,10 +1935,10 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 			asn1_get_length_der (der + counter, len - counter,
 					     &len2);
 		      if (len3 < 0)
-		        {
+			{
 			  result = ASN1_DER_ERROR;
 			  goto cleanup;
-                        }
+			}
 		      counter += len2;
 		      if (len3)
 			{
@@ -1964,25 +1964,25 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
 	      if (asn1_get_tag_der
 		  (der + counter, len - counter, &class, &len2,
 		   &tag) != ASN1_SUCCESS)
-                {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      if (counter + len2 > len)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      len4 =
 		asn1_get_length_der (der + counter + len2,
 				     len - counter - len2, &len3);
 	      if (len4 < -1)
-	        {
+		{
 		  result = ASN1_DER_ERROR;
 		  goto cleanup;
-                }
+		}
 
 	      if (len4 != -1)
 		{
diff --git a/lib/errors.c b/lib/errors.c
index 7878c50..76611d8 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -21,7 +21,7 @@
 
 #include <int.h>
 #ifdef STDC_HEADERS
-# include <stdarg.h>
+#include <stdarg.h>
 #endif
 
 #define LIBTASN1_ERROR_ENTRY(name) { #name, name }
diff --git a/lib/int.h b/lib/int.h
index fcaf0d8..82de579 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -23,7 +23,7 @@
 #define INT_H
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
 #endif
 
 #include <string.h>
@@ -33,7 +33,7 @@
 #include <stdint.h>
 
 #ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
+#include <sys/types.h>
 #endif
 
 #include <libtasn1.h>
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index ce55253..2e1f7ee 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -718,7 +718,8 @@ _asn1_expand_object_id (ASN1_TYPE node)
 		    {
 		      _asn1_str_cpy (name2, sizeof (name2), name_root);
 		      _asn1_str_cat (name2, sizeof (name2), ".");
-		      _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+		      _asn1_str_cat (name2, sizeof (name2),
+				     (char *) p2->value);
 		      p3 = asn1_find_node (node, name2);
 		      if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
 			  !(p3->type & CONST_ASSIGN))
diff --git a/lib/version.c b/lib/version.c
index fb17223..83d70c9 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -20,7 +20,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
 #endif
 
 #include <string.h>		/* for strverscmp */
diff --git a/maint.mk b/maint.mk
index a97e0bd..951b358 100644
--- a/maint.mk
+++ b/maint.mk
@@ -455,7 +455,8 @@ sc_prohibit_quotearg_without_use:
 
 # Don't include quote.h unless you use one of its functions.
 sc_prohibit_quote_without_use:
-	@h='quote.h' re='\<quote(_n)? *\(' $(_sc_header_without_use)
+	@h='quote.h' re='\<quote((_n)? *\(|_quoting_options\>)' \
+	  $(_sc_header_without_use)
 
 # Don't include this header unless you use one of its functions.
 sc_prohibit_long_options_without_use:
diff --git a/src/asn1Coding.c b/src/asn1Coding.c
index 131db7b..9ddb0a4 100644
--- a/src/asn1Coding.c
+++ b/src/asn1Coding.c
@@ -33,9 +33,9 @@
 
 /* This feature is available in gcc versions 2.5 and later.  */
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define ATTR_NO_RETRUN
+#define ATTR_NO_RETRUN
 #else
-# define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
+#define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
 #endif
 
 ATTR_NO_RETRUN static void
@@ -319,7 +319,8 @@ main (int argc, char *argv[])
 
       if (outputFile == NULL)
 	{
-	  printf ("asn1Coding: output file '%s' not available\n", outputFileName);
+	  printf ("asn1Coding: output file '%s' not available\n",
+		  outputFileName);
 	  free (der);
 	  free (inputFileAsnName);
 	  free (inputFileAssignmentName);
diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c
index c1f0876..2fa97a9 100644
--- a/src/asn1Decoding.c
+++ b/src/asn1Decoding.c
@@ -34,9 +34,9 @@
 
 /* This feature is available in gcc versions 2.5 and later.  */
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define ATTR_NO_RETRUN
+#define ATTR_NO_RETRUN
 #else
-# define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
+#define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
 #endif
 
 ATTR_NO_RETRUN static void
diff --git a/src/asn1Parser.c b/src/asn1Parser.c
index 37c9960..e14da83 100644
--- a/src/asn1Parser.c
+++ b/src/asn1Parser.c
@@ -33,9 +33,9 @@
 
 /* This feature is available in gcc versions 2.5 and later.  */
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define ATTR_NO_RETRUN
+#define ATTR_NO_RETRUN
 #else
-# define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
+#define ATTR_NO_RETRUN __attribute__ ((__noreturn__))
 #endif
 
 ATTR_NO_RETRUN static void
diff --git a/tests/Test_overflow.c b/tests/Test_overflow.c
index 2136899..747507f 100644
--- a/tests/Test_overflow.c
+++ b/tests/Test_overflow.c
@@ -66,7 +66,8 @@ main (void)
 	puts ("OK: asn1_get_length_der intnum");
       else
 	{
-	  printf ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l, len);
+	  printf ("ERROR: asn1_get_length_der intnum (l %ld len %d)\n", l,
+		  len);
 	  return 1;
 	}
     }
@@ -84,7 +85,8 @@ main (void)
       puts ("OK: asn1_get_length_der overflow");
     else
       {
-	printf ("ERROR: asn1_get_length_der overflow (l %ld len %d)\n", l, len);
+	printf ("ERROR: asn1_get_length_der overflow (l %ld len %d)\n", l,
+		len);
 	return 1;
       }
   }
diff --git a/tests/Test_simple.c b/tests/Test_simple.c
index 73d5178..9224036 100644
--- a/tests/Test_simple.c
+++ b/tests/Test_simple.c
@@ -35,45 +35,45 @@ struct tv
 };
 
 static const struct tv tv[] = {
-  { 0, "", 2, "\x01\x00" },
-  { 1, "\x00", 3, "\x02\x07\x00" },
-  { 2, "\x00", 3, "\x02\x06\x00" },
-  { 3, "\x00", 3, "\x02\x05\x00" },
-  { 4, "\x00", 3, "\x02\x04\x00" },
-  { 5, "\x00", 3, "\x02\x03\x00" },
-  { 6, "\x00", 3, "\x02\x02\x00" },
-  { 7, "\x00", 3, "\x02\x01\x00" },
-  { 8, "\x00\x00", 3, "\x02\x00\x00" },
-  { 9, "\x00\x00", 4, "\x03\x07\x00\x00" },
-  { 10, "\x00\x00", 4, "\x03\x06\x00\x00" },
-  { 11, "\x00\x00", 4, "\x03\x05\x00\x00" },
-  { 12, "\x00\x00", 4, "\x03\x04\x00\x00" },
-  { 13, "\x00\x00", 4, "\x03\x03\x00\x00" },
-  { 14, "\x00\x00", 4, "\x03\x02\x00\x00" },
-  { 15, "\x00\x00", 4, "\x03\x01\x00\x00" },
-  { 16, "\x00\x00", 4, "\x03\x00\x00\x00" },
-  { 17, "\x00\x00\x00", 5, "\x04\x07\x00\x00\x00" },
-  { 18, "\x00\x00\x00", 5, "\x04\x06\x00\x00\x00" },
-  { 19, "\x00\x00\x00", 5, "\x04\x05\x00\x00\x00" },
-  { 1, "\xFF", 3, "\x02\x07\x80" },
-  { 2, "\xFF", 3, "\x02\x06\xc0" },
-  { 3, "\xFF", 3, "\x02\x05\xe0" },
-  { 4, "\xFF", 3, "\x02\x04\xf0" },
-  { 5, "\xFF", 3, "\x02\x03\xf8" },
-  { 6, "\xFF", 3, "\x02\x02\xfc" },
-  { 7, "\xFF", 3, "\x02\x01\xfe" },
-  { 8, "\xFF\xFF", 3, "\x02\x00\xff" },
-  { 9, "\xFF\xFF", 4, "\x03\x07\xff\x80" },
-  { 10, "\xFF\xFF", 4, "\x03\x06\xff\xc0" },
-  { 11, "\xFF\xFF", 4, "\x03\x05\xff\xe0" },
-  { 12, "\xFF\xFF", 4, "\x03\x04\xff\xf0" },
-  { 13, "\xFF\xFF", 4, "\x03\x03\xff\xf8" },
-  { 14, "\xFF\xFF", 4, "\x03\x02\xff\xfc" },
-  { 15, "\xFF\xFF", 4, "\x03\x01\xff\xfe" },
-  { 16, "\xFF\xFF", 4, "\x03\x00\xff\xff" },
-  { 17, "\xFF\xFF\xFF", 5, "\x04\x07\xff\xff\x80" },
-  { 18, "\xFF\xFF\xFF", 5, "\x04\x06\xff\xff\xc0" },
-  { 19, "\xFF\xFF\xFF", 5, "\x04\x05\xff\xff\xe0" },
+  {0, "", 2, "\x01\x00"},
+  {1, "\x00", 3, "\x02\x07\x00"},
+  {2, "\x00", 3, "\x02\x06\x00"},
+  {3, "\x00", 3, "\x02\x05\x00"},
+  {4, "\x00", 3, "\x02\x04\x00"},
+  {5, "\x00", 3, "\x02\x03\x00"},
+  {6, "\x00", 3, "\x02\x02\x00"},
+  {7, "\x00", 3, "\x02\x01\x00"},
+  {8, "\x00\x00", 3, "\x02\x00\x00"},
+  {9, "\x00\x00", 4, "\x03\x07\x00\x00"},
+  {10, "\x00\x00", 4, "\x03\x06\x00\x00"},
+  {11, "\x00\x00", 4, "\x03\x05\x00\x00"},
+  {12, "\x00\x00", 4, "\x03\x04\x00\x00"},
+  {13, "\x00\x00", 4, "\x03\x03\x00\x00"},
+  {14, "\x00\x00", 4, "\x03\x02\x00\x00"},
+  {15, "\x00\x00", 4, "\x03\x01\x00\x00"},
+  {16, "\x00\x00", 4, "\x03\x00\x00\x00"},
+  {17, "\x00\x00\x00", 5, "\x04\x07\x00\x00\x00"},
+  {18, "\x00\x00\x00", 5, "\x04\x06\x00\x00\x00"},
+  {19, "\x00\x00\x00", 5, "\x04\x05\x00\x00\x00"},
+  {1, "\xFF", 3, "\x02\x07\x80"},
+  {2, "\xFF", 3, "\x02\x06\xc0"},
+  {3, "\xFF", 3, "\x02\x05\xe0"},
+  {4, "\xFF", 3, "\x02\x04\xf0"},
+  {5, "\xFF", 3, "\x02\x03\xf8"},
+  {6, "\xFF", 3, "\x02\x02\xfc"},
+  {7, "\xFF", 3, "\x02\x01\xfe"},
+  {8, "\xFF\xFF", 3, "\x02\x00\xff"},
+  {9, "\xFF\xFF", 4, "\x03\x07\xff\x80"},
+  {10, "\xFF\xFF", 4, "\x03\x06\xff\xc0"},
+  {11, "\xFF\xFF", 4, "\x03\x05\xff\xe0"},
+  {12, "\xFF\xFF", 4, "\x03\x04\xff\xf0"},
+  {13, "\xFF\xFF", 4, "\x03\x03\xff\xf8"},
+  {14, "\xFF\xFF", 4, "\x03\x02\xff\xfc"},
+  {15, "\xFF\xFF", 4, "\x03\x01\xff\xfe"},
+  {16, "\xFF\xFF", 4, "\x03\x00\xff\xff"},
+  {17, "\xFF\xFF\xFF", 5, "\x04\x07\xff\xff\x80"},
+  {18, "\xFF\xFF\xFF", 5, "\x04\x06\xff\xff\xc0"},
+  {19, "\xFF\xFF\xFF", 5, "\x04\x05\xff\xff\xe0"},
 };
 
 int
@@ -115,8 +115,7 @@ main (int argc, char *argv[])
       }
 #endif
 
-      if (der_len != tv[i].derlen
-	  || memcmp (der, tv[i].der, der_len) != 0)
+      if (der_len != tv[i].derlen || memcmp (der, tv[i].der, der_len) != 0)
 	{
 	  fprintf (stderr, "asn1_bit_der iter %ld\n", i);
 	  return 1;
@@ -140,7 +139,7 @@ main (int argc, char *argv[])
      STRING value "011011100101110111" can be any of the following,
      among others, depending on the choice of padding bits, the form
      of length octets [...]".
-  */
+   */
 
   /* 03 04 06 6e 5d c0  DER encoding */
 


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Sat Mar 31 14:17:57 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SE2s9-0002wU-VA
	for mharc-libtasn1-commit@gnu.org; Sat, 31 Mar 2012 14:17:57 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49762)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE2s6-0002vl-9m
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 14:17:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE2s3-0006uD-Dx
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 14:17:53 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:53768)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE2s3-0006u6-AF
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 14:17:51 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE2s2-000052-Ma
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 18:17:50 +0000
Date: Sat, 31 Mar 2012 18:17:50 +0000
Message-Id: <E1SE2s2-000052-Ma@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_12-1-g3873c6a
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 95ed3fdda525edd37ce0ea8eaf255a9b1563a25b
X-Git-Newrev: 3873c6a49122e3f15901646e072938557acd3f8e
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 31 Mar 2012 18:17:56 -0000

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=3873c6a49122e3f15901646e072938557acd3f8e

The branch, master has been updated
       via  3873c6a49122e3f15901646e072938557acd3f8e (commit)
      from  95ed3fdda525edd37ce0ea8eaf255a9b1563a25b (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 3873c6a49122e3f15901646e072938557acd3f8e
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sat Mar 31 20:16:48 2012 +0200

    Added overflow detection that does not depend on specific compiler, and asn1_get_der_length() verifies the length of the input data in small numbers as well.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                  |    3 ++
 lib/decoding.c        |   57 +++++++++++++++++++++++++++++++++++++-----------
 tests/Test_overflow.c |   57 +++++++++++++++++++++++++++++++++++++------------
 3 files changed, 90 insertions(+), 27 deletions(-)

diff --git a/NEWS b/NEWS
index 48c2528..3c50cb4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 GNU Libtasn1 NEWS                                     -*- outline -*-
 
+* Noteworthy changes in release 2.13 (unreleased) [stable]
+- Updated fix for DER decoding issue to not depend on specific compilers.
+
 * Noteworthy changes in release 2.12 (2012-03-19) [stable]
 - Cleanup license headers.
 - build: Update gnulib files.
diff --git a/lib/decoding.c b/lib/decoding.c
index eaca0d2..8f33930 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -30,6 +30,7 @@
 #include <gstr.h>
 #include "structure.h"
 #include "element.h"
+#include <limits.h>
 
 static asn1_retCode
 _asn1_get_indefinite_length_string (const unsigned char *der, int *len);
@@ -45,6 +46,22 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
 
 }
 
+inline static int safe_mul(int a, int b)
+{
+  if (INT_MAX/a < b)
+    return INT_MAX;
+  else
+    return a*b;
+}
+
+inline static int safe_add(int a, int b)
+{
+  if (INT_MAX-a < b)
+    return INT_MAX;
+  else
+    return a+b;
+}
+
 /**
  * asn1_get_length_der:
  * @der: DER data to decode.
@@ -60,7 +77,7 @@ _asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
 signed long
 asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 {
-  int ans;
+  int ans, sum;
   int k, punt;
 
   *len = 0;
@@ -71,7 +88,12 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len)
     {
       /* short form */
       *len = 1;
-      return der[0];
+      ans = der[0];
+      
+      if (ans > der_len)
+	return -4;
+      
+      return ans;
     }
   else
     {
@@ -83,10 +105,11 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 	  ans = 0;
 	  while (punt <= k && punt < der_len)
 	    {
-	      int last = ans;
-
-	      ans = ans * 256 + der[punt++];
-	      if (ans < last)
+	      ans = safe_mul(256, ans);
+	      if (ans == INT_MAX) return -2;
+	      
+	      ans = safe_add(der[punt++], ans);
+	      if (ans == INT_MAX)
 		/* we wrapped around, no bignum support... */
 		return -2;
 	    }
@@ -98,8 +121,10 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len)
 	}
 
       *len = punt;
-      if (ans + *len < ans || ans + *len > der_len)
+      sum = safe_add(ans, *len);
+      if (sum == INT_MAX || sum > der_len)
 	return -4;
+
       return ans;
     }
 }
@@ -139,18 +164,24 @@ asn1_get_tag_der (const unsigned char *der, int der_len,
       ris = 0;
       while (punt <= der_len && der[punt] & 128)
 	{
-	  int last = ris;
-	  ris = ris * 128 + (der[punt++] & 0x7F);
-	  if (ris < last)
+	  ris = safe_mul(128, ris);
+	  if (ris == INT_MAX)
+	    return ASN1_DER_ERROR;
+
+	  ris = safe_add(der[punt++] & 0x7F, ris);
+	  if (ris == INT_MAX)
 	    /* wrapper around, and no bignums... */
 	    return ASN1_DER_ERROR;
 	}
       if (punt >= der_len)
 	return ASN1_DER_ERROR;
       {
-	int last = ris;
-	ris = ris * 128 + (der[punt++] & 0x7F);
-	if (ris < last)
+        ris = safe_mul(128, ris);
+        if (ris == INT_MAX)
+          return ASN1_DER_ERROR;
+        
+        ris = safe_add(der[punt++] & 0x7F, ris);
+	if (ris == INT_MAX)
 	  /* wrapper around, and no bignums... */
 	  return ASN1_DER_ERROR;
       }
diff --git a/tests/Test_overflow.c b/tests/Test_overflow.c
index 747507f..bd6ede7 100644
--- a/tests/Test_overflow.c
+++ b/tests/Test_overflow.c
@@ -74,22 +74,51 @@ main (void)
 
   /* Test that values larger than would fit in the input string are
      rejected.  This problem was fixed in libtasn1 2.12. */
-  {
-    unsigned char der[] = "\x84\x7F\xFF\xFF\xFF";
-    long l;
-    int len;
+    {
+      unsigned long num = 64;
+      unsigned char der[20];
+      int der_len;
+      long l;
+      int len;
 
-    l = asn1_get_length_der (der, sizeof der, &len);
+      asn1_length_der (num, der, &der_len);
 
-    if (l == -4L)
-      puts ("OK: asn1_get_length_der overflow");
-    else
-      {
-	printf ("ERROR: asn1_get_length_der overflow (l %ld len %d)\n", l,
-		len);
-	return 1;
-      }
-  }
+      der_len = sizeof(der);
+      l = asn1_get_length_der (der, der_len, &len);
+
+      if (l == -4L)
+	puts ("OK: asn1_get_length_der overflow-small");
+      else
+	{
+	  printf ("ERROR: asn1_get_length_der overflow-small (l %ld len %d)\n", l,
+		  len);
+	  return 1;
+	}
+    }
+
+  /* Test that values larger than would fit in the input string are
+     rejected.  This problem was fixed in libtasn1 2.12. */
+    {
+      unsigned long num = 2147483647;
+      unsigned char der[20];
+      int der_len;
+      long l;
+      int len;
+
+      asn1_length_der (num, der, &der_len);
+
+      der_len = sizeof(der);
+      l = asn1_get_length_der (der, der_len, &len);
+
+      if (l == -2L)
+	puts ("OK: asn1_get_length_der overflow-large");
+      else
+	{
+	  printf ("ERROR: asn1_get_length_der overflow-large (l %ld len %d)\n", l,
+		  len);
+	  return 1;
+	}
+    }
 
   return 0;
 }


hooks/post-receive
-- 
GNU libtasn1


From MAILER-DAEMON Sat Mar 31 16:08:50 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SE4bS-0000GV-QL
	for mharc-libtasn1-commit@gnu.org; Sat, 31 Mar 2012 16:08:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33738)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE4bP-0000GG-T5
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 16:08:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE4bN-0007KM-Vf
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 16:08:47 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:54170)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE4bN-0007KE-SD
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 16:08:45 -0400
Received: from nmav by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SE4bN-0001gR-3K
	for libtasn1-commit@gnu.org; Sat, 31 Mar 2012 20:08:45 +0000
Date: Sat, 31 Mar 2012 20:08:45 +0000
Message-Id: <E1SE4bN-0001gR-3K@vcs.savannah.gnu.org>
From: "Nikos Mavrogiannopoulos" <nmav@gnutls.org>
To: libtasn1-commit@gnu.org
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_2_12-2-ge7a2f75
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3873c6a49122e3f15901646e072938557acd3f8e
X-Git-Newrev: e7a2f753a91f9538d2d98df0bb3bdc11005bfc82
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: libtasn1-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit messages for GNU Libtasn1 <libtasn1-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/libtasn1-commit>
List-Post: <mailto:libtasn1-commit@gnu.org>
List-Help: <mailto:libtasn1-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/libtasn1-commit>,
	<mailto:libtasn1-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 31 Mar 2012 20:08:49 -0000

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=e7a2f753a91f9538d2d98df0bb3bdc11005bfc82

The branch, master has been updated
       via  e7a2f753a91f9538d2d98df0bb3bdc11005bfc82 (commit)
      from  3873c6a49122e3f15901646e072938557acd3f8e (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 e7a2f753a91f9538d2d98df0bb3bdc11005bfc82
Author: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date:   Sat Mar 31 22:08:36 2012 +0200

    Added additional test case

-----------------------------------------------------------------------

Summary of changes:
 tests/Test_overflow.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tests/Test_overflow.c b/tests/Test_overflow.c
index bd6ede7..cbf9381 100644
--- a/tests/Test_overflow.c
+++ b/tests/Test_overflow.c
@@ -99,6 +99,30 @@ main (void)
   /* Test that values larger than would fit in the input string are
      rejected.  This problem was fixed in libtasn1 2.12. */
     {
+      unsigned long num = 1073741824;
+      unsigned char der[20];
+      int der_len;
+      long l;
+      int len;
+
+      asn1_length_der (num, der, &der_len);
+
+      der_len = sizeof(der);
+      l = asn1_get_length_der (der, der_len, &len);
+
+      if (l == -4L)
+	puts ("OK: asn1_get_length_der overflow-large1");
+      else
+	{
+	  printf ("ERROR: asn1_get_length_der overflow-large1 (l %ld len %d)\n", l,
+		  len);
+	  return 1;
+	}
+    }
+
+  /* Test that values larger than would fit in the input string are
+     rejected.  This problem was fixed in libtasn1 2.12. */
+    {
       unsigned long num = 2147483647;
       unsigned char der[20];
       int der_len;
@@ -111,10 +135,10 @@ main (void)
       l = asn1_get_length_der (der, der_len, &len);
 
       if (l == -2L)
-	puts ("OK: asn1_get_length_der overflow-large");
+	puts ("OK: asn1_get_length_der overflow-large2");
       else
 	{
-	  printf ("ERROR: asn1_get_length_der overflow-large (l %ld len %d)\n", l,
+	  printf ("ERROR: asn1_get_length_der overflow-large2 (l %ld len %d)\n", l,
 		  len);
 	  return 1;
 	}


hooks/post-receive
-- 
GNU libtasn1


