Skip to content

Draft: asn1_decode_simple_der: accept empty OCTET STRING

Daiki Ueno requested to merge dueno/libtasn1:wip/dueno/empty-octet-string into master

When the input was an empty OCTET STRING (i.e., 0x04 0x00 in DER), asn1_decode_simple_der previously returned ASN1_DER_ERROR.

With this patch, the function properly returns zero as the length, while the output pointer is set to the start of the input, to satisfy the invariant that it is a valid pointer inside the input.

Fixes: #48

Checklist

  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent with other code
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code

Merge request reports