Merge branch 'tmp-restore-size' into 'master'

SIZE: restore handling of SIZE nodes

See merge request gnutls/libtasn1!68
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4a9f22a..56819f6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,6 @@
 variables:
   BUILD_IMAGES_PROJECT: gnutls/build-images
-  FEDORA_BUILD: buildenv-f31
+  FEDORA_BUILD: buildenv-fedora33
   DEBIAN_X86_CROSS_BUILD: buildenv-debian-x86-cross
   GET_SOURCES_ATTEMPTS: "3"
 
diff --git a/bootstrap.conf b/bootstrap.conf
index 45e9689..c8a85b8 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -42,7 +42,7 @@
 autoconf   2.62
 automake   1.11.1
 git        1.4.4
-bison      -
+bison      3.6
 "
 
 GTKDOCIZE=$(which gtkdocize 2>/dev/null)
diff --git a/doc/libtasn1.texi b/doc/libtasn1.texi
index b57e74d..2879d28 100644
--- a/doc/libtasn1.texi
+++ b/doc/libtasn1.texi
@@ -15,7 +15,7 @@
 which is a library for Abstract Syntax Notation One (ASN.1) and
 Distinguished Encoding Rules (DER) manipulation.
 
-Copyright @copyright{} 2001-2020 Free Software Foundation, Inc.
+Copyright @copyright{} 2001-2021 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/lib/coding.c b/lib/coding.c
index 245ea64..e76114d 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -265,9 +265,6 @@
   int len_len;
   int max_len;
 
-  if (der == NULL)
-    return ASN1_VALUE_NOT_VALID;
-
   max_len = *der_len;
 
   asn1_length_der (str_len, (max_len > 0) ? der : NULL, &len_len);
@@ -959,9 +956,6 @@
   unsigned char *out = NULL;
   int err;
 
-  if (der == NULL)
-    return ASN1_VALUE_NOT_VALID;
-
   counter = 0;
 
   if (type_field (node->type) != ASN1_ETYPE_SET_OF)
@@ -1084,6 +1078,7 @@
   int counter, counter_old, len2, len3, move, max_len, max_len_old;
   int err;
   unsigned char *der = ider;
+  unsigned char dummy;
 
   if (ErrorDescription)
     ErrorDescription[0] = 0;
@@ -1204,7 +1199,7 @@
 		  goto error;
 		}
 	      len2 = max_len;
-	      err = _asn1_object_id_der ((char*)p->value, der + counter, &len2);
+	      err = _asn1_object_id_der ((char*)p->value, der ? der + counter : &dummy, &len2);
 	      if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR)
 		goto error;
 
@@ -1222,7 +1217,7 @@
 	      goto error;
 	    }
 	  len2 = max_len;
-	  err = _asn1_time_der (p->value, p->value_len, der + counter, &len2);
+	  err = _asn1_time_der (p->value, p->value_len, der ? der + counter : &dummy, &len2);
 	  if (err != ASN1_SUCCESS && err != ASN1_MEM_ERROR)
 	    goto error;
 
@@ -1290,7 +1285,7 @@
 	      p->tmp_ival = 0;
 	      if ((type_field (p->type) == ASN1_ETYPE_SET) && (max_len >= 0))
 		{
-		  err = _asn1_ordering_set (der + len2, counter - len2, p);
+		  err = _asn1_ordering_set (der ? der + len2 : &dummy, counter - len2, p);
 		  if (err != ASN1_SUCCESS)
 		    goto error;
 		}
@@ -1331,7 +1326,7 @@
 	      if ((type_field (p->type) == ASN1_ETYPE_SET_OF)
 		  && (counter - len2 > 0) && (max_len >= 0))
 		{
-		  err = _asn1_ordering_set_of (der + len2, counter - len2, p);
+		  err = _asn1_ordering_set_of (der ? der + len2 : &dummy, counter - len2, p);
 		  if (err != ASN1_SUCCESS)
 		    goto error;
 		}
diff --git a/lib/decoding.c b/lib/decoding.c
index ff04eb7..5c26c67 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -32,7 +32,7 @@
 #include <element.h>
 #include <limits.h>
 #include <intprops.h>
-#include <c-ctype.h>
+#include "c-ctype.h"
 
 #ifdef DEBUG
 # define warn() fprintf(stderr, "%s: %d\n", __func__, __LINE__)
diff --git a/src/Makefile.am b/src/Makefile.am
index 4459767..3dabda1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,7 @@
 AM_CPPFLAGS = -I$(top_builddir)/lib/includes -I$(top_srcdir)/lib/includes \
  -I$(top_builddir)/lib/gl -I$(top_srcdir)/lib/gl $(CODE_COVERAGE_CPPFLAGS)
 
-LDADD = ../lib/libtasn1.la
+LDADD = ../lib/libtasn1.la ../lib/gl/libgnu.la
 AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
 
 bin_PROGRAMS = asn1Parser asn1Coding asn1Decoding
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index 178f111..ff01311 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -49,7 +49,7 @@
    "TEST_PARSER2 { } DEFINITIONS IMPLICIT TAGS ::= BEGIN int1 ::= INTEGER END",
    ASN1_SYNTAX_ERROR,
    _FILE_
-   ":6: Error: syntax error, unexpected IDENTIFIER, expecting $end near 'TEST_PARSER'"},
+   ":6: Error: syntax error, unexpected IDENTIFIER, expecting end of file near 'TEST_PARSER'"},
   {6, "TEST_PARSER { }", ASN1_SUCCESS, ""},
 
   /* Test ASN1_MAX_NAME_SIZE (128) */