[arch-commits] Commit in libtasn1/trunk (PKGBUILD multi-byte-fix.diff)

Andreas Radke andyrtr at archlinux.org
Mon Sep 14 16:56:15 UTC 2015


    Date: Monday, September 14, 2015 @ 18:56:15
  Author: andyrtr
Revision: 246037

upgpkg: libtasn1 4.6-2

fix a regression that introduced errors in gnutls

Added:
  libtasn1/trunk/multi-byte-fix.diff
Modified:
  libtasn1/trunk/PKGBUILD

---------------------+
 PKGBUILD            |   14 ++++-
 multi-byte-fix.diff |  132 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-09-14 16:34:31 UTC (rev 246036)
+++ PKGBUILD	2015-09-14 16:56:15 UTC (rev 246037)
@@ -5,7 +5,7 @@
 
 pkgname=libtasn1
 pkgver=4.6
-pkgrel=1
+pkgrel=2
 pkgdesc="The ASN.1 library used in GNUTLS"
 arch=('i686' 'x86_64')
 license=('GPL3' 'LGPL')
@@ -12,11 +12,19 @@
 url="http://www.gnu.org/software/libtasn1/"
 depends=('glibc' 'texinfo')
 install=libtasn1.install
-source=(http://ftp.gnu.org/gnu/libtasn1/${pkgname}-${pkgver}.tar.gz{,.sig})
+source=(http://ftp.gnu.org/gnu/libtasn1/${pkgname}-${pkgver}.tar.gz{,.sig}
+        multi-byte-fix.diff)
 md5sums=('454a7f80362f38bd2335b6e9d95f57a6'
-         'SKIP')
+         'SKIP'
+         'd785762c19c4b2685d9034ed8ca1b3bc')
 validpgpkeys=('1F42418905D8206AA754CCDC29EE58B996865171') #Nikos Mavrogiannopoulos <nmav at gnutls.org>
 
+prepare() {
+  cd ${pkgname}-${pkgver}
+  # http://git.savannah.gnu.org/gitweb/?p=libtasn1.git;a=commit;h=e4478fb4a0186f9d59969bf93ed8fa6074729b43
+  patch -Np1 -i ${srcdir}/multi-byte-fix.diff
+}
+
 build() {
   cd ${pkgname}-${pkgver}
   ./configure --prefix=/usr \

Added: multi-byte-fix.diff
===================================================================
--- multi-byte-fix.diff	                        (rev 0)
+++ multi-byte-fix.diff	2015-09-14 16:56:15 UTC (rev 246037)
@@ -0,0 +1,132 @@
+X-Git-Url: 
+http://git.savannah.gnu.org/gitweb/?p=libtasn1.git;a=blobdiff_plain;f=lib%2Fdecoding.c;h=caf1eb47aa55941260a1e03d8b1c079afb546b51;hp=4d2302f5e57ba67d8c753eec8e88038a0197dca5;hb=a6a05643f0a1a9a5ea431bab65998a7c68b25c03;hpb=4e7a89e701d43f73b2b1398ad1eda470f7ddb9ee
+
+diff --git a/lib/decoding.c b/lib/decoding.c
+index 4d2302f..caf1eb4 100644
+--- a/lib/decoding.c
++++ b/lib/decoding.c
+@@ -480,10 +480,12 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
+   return ASN1_SUCCESS;
+ }
+ 
+-
++/* tag_len: the total tag length (explicit+inner)
++ * inner_tag_len: the inner_tag length
++ */
+ static int
+ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
+-		       int *ret_len, unsigned flags)
++		       int *tag_len, int *inner_tag_len, unsigned flags)
+ {
+   asn1_node p;
+   int counter, len2, len3, is_tag_implicit;
+@@ -594,7 +596,9 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
+       unsigned type = type_field (node->type);
+       if (type == ASN1_ETYPE_TAG)
+ 	{
+-	  *ret_len = 0;
++	  *tag_len = 0;
++	  if (inner_tag_len)
++	    *inner_tag_len = 0;
+ 	  return ASN1_SUCCESS;
+ 	}
+ 
+@@ -654,7 +658,9 @@ _asn1_extract_tag_der (asn1_node node, const unsigned char *der, int der_len,
+     }
+ 
+   counter += len2;
+-  *ret_len = counter;
++  *tag_len = counter;
++  if (inner_tag_len)
++    *inner_tag_len = len2;
+   return ASN1_SUCCESS;
+ 
+ cleanup:
+@@ -663,7 +669,7 @@ cleanup:
+ 
+ static int
+ extract_tag_der_recursive(asn1_node node, const unsigned char *der, int der_len,
+-		       int *ret_len, unsigned flags)
++		       int *ret_len, int *inner_len, unsigned flags)
+ {
+ asn1_node p;
+ int ris = ASN1_DER_ERROR;
+@@ -673,7 +679,7 @@ int ris = ASN1_DER_ERROR;
+       p = node->down;
+       while (p)
+         {
+-          ris = _asn1_extract_tag_der (p, der, der_len, ret_len, flags);
++          ris = _asn1_extract_tag_der (p, der, der_len, ret_len, inner_len, flags);
+           if (ris == ASN1_SUCCESS)
+             break;
+           p = p->right;
+@@ -683,7 +689,7 @@ int ris = ASN1_DER_ERROR;
+       return ris;
+     }
+   else
+-    return _asn1_extract_tag_der (node, der, der_len, ret_len, flags);
++    return _asn1_extract_tag_der (node, der, der_len, ret_len, inner_len, flags);
+ }
+ 
+ static int
+@@ -1014,6 +1020,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+   unsigned long tag;
+   int tag_len;
+   int indefinite, result, total_len = *max_ider_len, ider_len = *max_ider_len;
++  int inner_tag_len;
+   const unsigned char *der = ider;
+ 
+   node = *element;
+@@ -1037,6 +1044,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+   while (1)
+     {
+       tag_len = 0;
++      inner_tag_len = 0;
+       ris = ASN1_SUCCESS;
+       if (move != UP)
+ 	{
+@@ -1074,7 +1082,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+ 		    {
+ 		      ris =
+ 			  extract_tag_der_recursive (p2, der + counter,
+-						     ider_len, &len2, flags);
++						     ider_len, &len2, NULL, flags);
+ 		      if (ris == ASN1_SUCCESS)
+ 			{
+ 			  p2->type &= ~CONST_NOT_USED;
+@@ -1124,7 +1132,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+ 		{
+ 		  ris =
+ 		      extract_tag_der_recursive (p->down, der + counter,
+-					         ider_len, &len2, flags);
++					         ider_len, &len2, NULL, flags);
+ 
+ 		  if (ris == ASN1_SUCCESS)
+ 		    {
+@@ -1171,7 +1179,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+ 	  if (ris == ASN1_SUCCESS)
+ 	    ris =
+ 	      extract_tag_der_recursive (p, der + counter, ider_len, 
+-	                                 &tag_len, flags);
++	                                 &tag_len, &inner_tag_len, flags);
+ 
+ 	  if (ris != ASN1_SUCCESS)
+ 	    {
+@@ -1289,14 +1297,15 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len,
+ 	      move = RIGHT;
+ 	      break;
+ 	    case ASN1_ETYPE_OCTET_STRING:
+-	      if (counter < tag_len)
++	      if (counter < inner_tag_len)
+ 	        {
+ 		  result = ASN1_DER_ERROR;
+                   warn();
+ 		  goto cleanup;
+ 	        }
++
+ 	      result = get_octet_string (p, der + counter, ider_len, 
+-	      				 der + counter - tag_len, tag_len,
++	      				 der + counter - inner_tag_len, inner_tag_len,
+ 	      				 &len3, flags);
+ 	      if (result != ASN1_SUCCESS)
+ 	        {



More information about the arch-commits mailing list