Bug 1011009 - BER decoder for Boolean accepts only (0,1)
BER decoder for Boolean accepts only (0,1)
Product: Fedora
Classification: Fedora
Component: python-pyasn1 (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Rob Crittenden
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-09-23 09:23 EDT by Ludwig
Modified: 2013-09-30 09:54 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-30 09:54:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
pcap shwoing the encoded value (2.78 KB, application/vnd.tcpdump.pcap)
2013-09-23 11:40 EDT, Ludwig
no flags Details
wireshark highlighting the field (128.76 KB, image/png)
2013-09-23 11:41 EDT, Ludwig
no flags Details
C program to write out a BER file using openldap (898 bytes, text/x-csrc)
2013-09-23 14:23 EDT, Rob Crittenden
no flags Details
python-pyasn1 script to read the ber file (331 bytes, text/x-python)
2013-09-23 14:24 EDT, Rob Crittenden
no flags Details

  None (edit)
Description Ludwig 2013-09-23 09:23:48 EDT
Description of problem:

the asn1 decoder only accepts (0,1) for Boolean, but the ITU x.690 spec in chapter 8.2 defines Boolean in BER

If the boolean value is:
the octet shall be zero.
If the boolean value is
the octet shall have any non-zero value, as a sender's option.
If of type BOOLEAN, the value TRUE can be encoded as:
Boolean Length Contents
01         01         FF

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
encode a ber message with the openldap function 
It is encoded as 0xff

run python client decoding the message, an exception is raised:
pyasn1.type.error.ValueConstraintError: ConstraintsIntersection(ConstraintsIntersection(), SingleValueConstraint(0, 1)) failed at: "SingleValueConstraint(0, 1) failed at: "-1""


Actual results:

Expected results:

Additional info:
Comment 1 Ludwig 2013-09-23 11:40:51 EDT
Created attachment 801739 [details]
pcap shwoing the encoded value
Comment 2 Ludwig 2013-09-23 11:41:59 EDT
Created attachment 801742 [details]
wireshark highlighting the field
Comment 3 Rob Crittenden 2013-09-23 14:23:34 EDT
Created attachment 801850 [details]
C program to write out a BER file using openldap
Comment 4 Rob Crittenden 2013-09-23 14:24:25 EDT
Created attachment 801851 [details]
python-pyasn1 script to read the ber file

This demonstrates the bug as reported
Comment 5 Rob Crittenden 2013-09-23 15:45:13 EDT
This was fixed in 0.1.4 so I'll need to consider updating the package version in F-18. Is this work you're doing going to land in F-18?
Comment 6 Ludwig 2013-09-24 03:28:39 EDT
I was using the python client to test a feature which will be in 389 version 1.3.2, so this would be in F20 I think.
I didn't see that it was fixed, is there a bz for that fix ?
Comment 7 Rob Crittenden 2013-09-24 08:15:25 EDT
F-20 has 0.1.7 and my testing confirms it works as expected.

The upstream 0.1.4 changelog has this, which I suspect is what fixed things:

- Fix to BER Boolean decoder that allows other pre-computed
  values besides 0 and 1
Comment 8 Rob Crittenden 2013-09-30 09:54:29 EDT
I'm going to close this since it works in F-19 and 20.

Note You need to log in before you can comment on or make changes to this bug.