[gnutls-devel] libtasn1 | Reading CHOICE name confuses valgrind (#9)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Thu Jul 18 14:55:16 CEST 2019



Daiki Ueno created an issue:


  ## Description of problem:

Maybe this is a false-positive in valgrind, but it reports "Conditional jump or move depends on uninitialised value(s)" when I access a certain position of CHOICE node name returned by `asn1_read_value`, i.e.,

```c
  data_size = sizeof(data);
  result = asn1_read_value (node2, "", data, &data_size);
  if (result != ASN1_SUCCESS)
    {
      printf ("error in %d\n", __LINE__);
      exit (1);
    }

  if (strcmp (data, "012345678901234") == 0) // <--
    {
      printf ("error in %d\n", __LINE__);
      exit (1);
    }
```

Interestingly, valgrind doesn't complain if the needle is shorter than 16 nor the program is compiled with -O0.

## Version of libtasn1 used:

git master

## Distributor of libtasn1 (e.g., Ubuntu, Fedora, RHEL)


## How reproducible:

* Apply [libtasn1-valgrind.patch](/uploads/8308e39fc5d84559862c5c0cfbdff6be/libtasn1-valgrind.patch) to `tests/Test_choice.c` and do the following:

```sh
$ ./configure CFLAGS="-O2 -g3 -Wall"
$ make
$ make check LOG_COMPILER="valgrind --error-exitcode=1" TESTS=Test_choice V=1
$ cat tests/Test_choice.log
```

## Actual results:

The log contains:
```
==1297== Conditional jump or move depends on uninitialised value(s)
==1297==    at 0x4013DD: main (Test_choice.c:122)
```

## Expected results:

The log shouldn't contain the error.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/libtasn1/issues/9
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/20190718/28ae9e27/attachment-0001.html>


More information about the Gnutls-devel mailing list