tests / asn1Decoding.c: Improve test coverage and Fix asn1Decoding Issues

  1. tests/ : Improve test coverage of libtasn1 executables asn1Decoding.c, asn1Parser.c, and asn1Coding.c. With the test additions, the following change in code coverage was observed: (before):
Directory Line Coverage
libtasn1/fuzz 80.0 %
libtasn1/lib 85.4 %
libtasn1/libtasn1/lib/gl 100.0 %
libtasn1/libtasn1/src 38.2 %
libtasn1/libtasn1/src/gl 0.0 %
/usr/include 100.0 %

(after):

Directory Line Coverage
libtasn1/fuzz 80.0 %
libtasn1/lib 85.6 %
libtasn1/libtasn1/lib/gl 100.0 %
libtasn1/libtasn1/src 86.8 %
libtasn1/libtasn1/src/gl 100.0 %
/usr/include 100.0 %
  1. asn1Decoding.c: Made the following corrections observed during test development:
  • Removed a stray / unused "c" option from the short option list.
  • Ensure tmplen is initialized prior to use in all possible error paths.
  • Ensure realloc is not called with a zero length when the debug option is set and an empty input is provided - realloc with size zero appears to have undefined behavior per the function definition.

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

Loading