[openssl/openssl] 278b0d: Fix asan finding in bio_addr

openssl-machine noreply at github.com
Fri Aug 12 15:20:59 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 278b0d8b674eba6f6e1ec51a18c3ccaf8db02701
      https://github.com/openssl/openssl/commit/278b0d8b674eba6f6e1ec51a18c3ccaf8db02701
  Author: Juergen Christ <jchrist at linux.ibm.com>
  Date:   2022-08-12 (Fri, 12 Aug 2022)

  Changed paths:
    M crypto/bio/bio_addr.c

  Log Message:
  -----------
  Fix asan finding in bio_addr

Running test_tfo_cli under asan yields
==166214==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700000d57c at pc 0x03ffa004ed86 bp 0x03ffe2977e80 sp 0x03ffe2977668
READ of size 112 at 0x60700000d57c thread T0
    #0 0x3ffa004ed85 in memcpy (/lib64/libasan.so.8+0x4ed85)
    #1 0x3ff9f3615b7 in BIO_ADDR_dup crypto/bio/bio_addr.c:77
[...]
and fails the test.

Fix this by copying the right structure of the union.

Signed-off-by: Juergen Christ <jchrist at linux.ibm.com>

Reviewed-by: Todd Short <todd.short at me.com>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18979)


  Commit: d272ef5372a16924a5804b74a76491b1bc8529b5
      https://github.com/openssl/openssl/commit/d272ef5372a16924a5804b74a76491b1bc8529b5
  Author: Juergen Christ <jchrist at linux.ibm.com>
  Date:   2022-08-12 (Fri, 12 Aug 2022)

  Changed paths:
    M test/bio_tfo_test.c

  Log Message:
  -----------
  Fix asan finding in bio_tfo_test

Running bio_tfo_test under asan yields
==172342==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 380 byte(s) in 5 object(s) allocated from:
    #0 0x3ff89bba251 in malloc (/lib64/libasan.so.8+0xba251)
    #1 0x3ff88cf9fd5 in gaih_inet.constprop.0 (/lib64/libc.so.6+0xf9fd5)
    #2 0x3ff88cfaf6f in getaddrinfo (/lib64/libc.so.6+0xfaf6f)
    #3 0x3ff89ba52a9 in __interceptor_getaddrinfo.part.0 (/lib64/libasan.so.8+0xa52a9)
    #4 0x1004909 in test_fd_tfo test/bio_tfo_test.c:241
[...]

and fails the test.

Fix this by freeing the return addrinfo on exit.

Signed-off-by: Juergen Christ <jchrist at linux.ibm.com>

Reviewed-by: Todd Short <todd.short at me.com>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18979)


Compare: https://github.com/openssl/openssl/compare/d13c8b772543...d272ef5372a1


More information about the openssl-commits mailing list