diff options
author | elie <elie> | 2015-04-24 18:36:40 +0000 |
---|---|---|
committer | elie <elie> | 2015-04-24 18:36:40 +0000 |
commit | c2204e13e60f514e2fafe601959ec4ea444d5c20 (patch) | |
tree | d5911bc1b194e78613c01e045036a3d5460f730b | |
parent | 7a69bc04e598874ef7b6ab7cac1f85d9dcc532a3 (diff) | |
download | pyasn1-c2204e13e60f514e2fafe601959ec4ea444d5c20.tar.gz |
fix to broken REAL type decoding handling
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | pyasn1/codec/ber/decoder.py | 6 |
2 files changed, 8 insertions, 3 deletions
@@ -1,5 +1,5 @@ -Revision 0.1.8 --------------- +Revision 0.1.8rc2 +----------------- - ObjectIdentifier codec fixed to work properly with arc 0 and arc 2 values. - Explicit limit on ObjectIdentifier arc value size removed. @@ -51,6 +51,7 @@ Revision 0.1.8 - Encoding bases 8 and 16 support for REAL type binary encoder added. - Fix to REAL type binary decoder to handle different bases and scale factor. - Fix to TagSet.repr() to include [obsolete] baseTag information. +- Fix to broken REAL type decoding handling. Revision 0.1.7 -------------- diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py index 28a666d..7bb09ea 100644 --- a/pyasn1/codec/ber/decoder.py +++ b/pyasn1/codec/ber/decoder.py @@ -264,7 +264,9 @@ class RealDecoder(AbstractSimpleDecoder): if not head: return self._createComponent(asn1Spec, tagSet, 0.0), tail fo = oct2int(head[0]); head = head[1:] - if fo & 0x80: # binary enoding + if fo & 0x80: # binary encoding + if not head: + raise error.PyAsn1Error("Incomplete floating-point value") n = (fo & 0x03) + 1 if n == 4: n = oct2int(head[0]) @@ -297,6 +299,8 @@ class RealDecoder(AbstractSimpleDecoder): elif fo & 0x40: # infinite value value = fo & 0x01 and '-inf' or 'inf' elif fo & 0xc0 == 0: # character encoding + if not head: + raise error.PyAsn1Error("Incomplete floating-point value") try: if fo & 0x3 == 0x1: # NR1 value = (int(head), 10, 0) |