[gnutls-devel] libtasn1 | Draft: tests / asn1Decoding.c: Improve test coverage and Fix asn1Decoding Issues (!116)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sat Feb 1 22:17:09 CET 2025



Andrew Hamilton created a merge request: https://gitlab.com/gnutls/libtasn1/-/merge_requests/116

Project:Branches: adhamilt/libtasn1:testCoverageBumpv2 to gnutls/libtasn1:master
Author:   Andrew Hamilton




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 % |

2. 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
 * [X] Code modified for feature
 * [X] Test suite updated with functionality tests
 * [X] 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

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/libtasn1/-/merge_requests/116
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20250201/34c8b482/attachment.html>


More information about the Gnutls-devel mailing list