Package: python-crypto
Version: 2.6.1-4
Severity: normal
Tags: patch

Hi,

/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.py has the following
bug twice:

this:
        p = DerObject.decode(derEle, noLeftOvers)
should be:
        p = DerObject.decode(self, derEle, noLeftOvers)

Right now you end up with the following every type one tries to use
DerObjectId or DerOctetString:

  File "/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.py", line 274,
  in decode
      p = DerObject.decode(derEle, noLeftOvers)
      TypeError: unbound method decode() must be called with DerObject
      instance as first argument (got str instance instead)

The attached patch should be fixing this problem

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14.0-v2-v (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages python-crypto depends on:
ii  libc6       2.18-4
ii  libgmp10    2:6.0.0+dfsg-2
ii  python      2.7.5-5
pn  python:any  <none>

python-crypto recommends no packages.

Versions of packages python-crypto suggests:
pn  python-crypto-dbg  <none>
pn  python-crypto-doc  <none>

-- debconf-show failed
diff -Nur python-crypto-2.6.1.orig/lib/Crypto/Util/asn1.py python-crypto-2.6.1/lib/Crypto/Util/asn1.py
--- python-crypto-2.6.1.orig/lib/Crypto/Util/asn1.py	2013-10-14 22:38:10.000000000 +0100
+++ python-crypto-2.6.1/lib/Crypto/Util/asn1.py	2014-04-27 19:27:11.602641108 +0100
@@ -257,7 +257,7 @@
         self.payload = value
 
     def decode(self, derEle, noLeftOvers=0):
-        p = DerObject.decode(derEle, noLeftOvers)
+        p = DerObject.decode(self, derEle, noLeftOvers)
         if not self.isType("OCTET STRING"):
             raise ValueError("Not a valid OCTET STRING.")
         return p
@@ -271,7 +271,7 @@
         DerObject.__init__(self, 'OBJECT IDENTIFIER')
 
     def decode(self, derEle, noLeftOvers=0):
-        p = DerObject.decode(derEle, noLeftOvers)
+        p = DerObject.decode(self, derEle, noLeftOvers)
         if not self.isType("OBJECT IDENTIFIER"):
             raise ValueError("Not a valid OBJECT IDENTIFIER.")
         return p

Reply via email to