microsoft / microsoft/msquic

Heap-buffer-overflow detected by ASAN

Open
#5,331 10 comments 0 reactions 1 assignee View on GitHub

@gaurav2699 is already working on this.

Since Aug 28, 2025.

Area: Core Triaged
Dominant language
C
Stars
4.8k
Forks
699
Avg merge
2d 22h
Merged PRs (30d)
35

Description

Describe the bug

While running msquic with ASAN activated on an environment with traffic, I am seeing the following:

==1457588==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x52105134d471 at pc 0x000000fa3ab5 bp 0x7be38203e870 sp 0x7be38203e860
READ of size 2 at 0x52105134d471 thread T22
    #0 0xfa3ab4 in QuicConnRecvDatagrams /msquic/src/core/connection.c:5887
    #1 0xfa3dbf in QuicConnFlushRecv /msquic/src/core/connection.c:5944
    #2 0xfab576 in QuicConnDrainOperations /msquic/src/core/connection.c:7817
    #3 0xfe33b5 in QuicWorkerProcessConnection /msquic/src/core/worker.c:579
    #4 0xfe4d92 in QuicWorkerLoop /msquic/src/core/worker.c:740
    #5 0xfd8df8 in CxPlatRunExecutionContexts /msquic/src/platform/platform_worker.c:562
    #6 0xfd9bb8 in CxPlatWorkerThread /msquic/src/platform/platform_worker.c:730
    #7 0x7be3e385ea41 in asan_thread_start ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
    #8 0x7be3e349caa3  (/lib/x86_64-linux-gnu/libc.so.6+0x9caa3) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)
    #9 0x7be3e3529c3b  (/lib/x86_64-linux-gnu/libc.so.6+0x129c3b) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)
0x52105134d471 is located 143 bytes before 4128-byte region [0x52105134d500,0x52105134e520)
allocated by thread T17 here:
    #0 0x7be3e38fd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x100f784 in QuicRecvBufferInitialize /msquic/src/core/recv_buffer.c:298
    #2 0x1056372 in QuicCryptoInitialize /msquic/src/core/crypto.c:151
    #3 0xfab72b in QuicConnDrainOperations /msquic/src/core/connection.c:7774
    #4 0xfe33b5 in QuicWorkerProcessConnection /msquic/src/core/worker.c:579
    #5 0xfe4d92 in QuicWorkerLoop /msquic/src/core/worker.c:740
    #6 0xfd8df8 in CxPlatRunExecutionContexts /msquic/src/platform/platform_worker.c:562
    #7 0xfd9bb8 in CxPlatWorkerThread /msquic/src/platform/platform_worker.c:730
    #8 0x7be3e385ea41 in asan_thread_start ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
    #9 0x7be3e349caa3  (/lib/x86_64-linux-gnu/libc.so.6+0x9caa3) (BuildId: 282c2c16e7b6600b0b22ea0c99010d2795752b5f)
Thread T22 created by T0 here:
    #0 0x7be3e38f51f9 in pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:245
    #1 0xf80e06 in CxPlatThreadCreate /msquic/src/platform/platform_posix.c:688
    #2 0xfd752f in CxPlatWorkerPoolInitWorker /msquic/src/platform/platform_worker.c:211
    #3 0xfd81c8 in CxPlatWorkerPoolCreate /msquic/src/platform/platform_worker.c:329
    #4 0xf872f7 in QuicLibraryLazyInitialize /msquic/src/core/library.c:812
    #5 0x100d930 in MsQuicRegistrationOpen /msquic/src/core/registration.c:59
    #6 0xf7c89a in MsQuicSetup /_/github.com/noboruma/go-msquic@v0.16.2/pkg/quic/c/msquic.c:577
Thread T17 created by T0 here:
    #0 0x7be3e38f51f9 in pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:245
    #1 0xf80e06 in CxPlatThreadCreate /msquic/src/platform/platform_posix.c:688
    #2 0xfd752f in CxPlatWorkerPoolInitWorker /msquic/src/platform/platform_worker.c:211
    #3 0xfd81c8 in CxPlatWorkerPoolCreate /msquic/src/platform/platform_worker.c:329
    #4 0xf872f7 in QuicLibraryLazyInitialize /msquic/src/core/library.c:812
    #5 0x100d930 in MsQuicRegistrationOpen /msquic/src/core/registration.c:59
    #6 0xf7c89a in MsQuicSetup /_/github.com/noboruma/go-msquic@v0.16.2/pkg/quic/c/msquic.c:577
SUMMARY: AddressSanitizer: heap-buffer-overflow /msquic/src/core/connection.c:5887 in QuicConnRecvDatagrams
Shadow bytes around the buggy address:
  0x52105134d180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x52105134d200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x52105134d280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x52105134d300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x52105134d380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x52105134d400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]fa
  0x52105134d480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x52105134d500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x52105134d580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x52105134d600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x52105134d680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==1457588==ABORTING
Affected OS
  • Windows
  • Linux
  • macOS
  • Other (specify below)
Additional OS information

No response

MsQuic version

main

Steps taken to reproduce bug

Leave msquic running for some time with traffic opening streams & connection on a regular basis.

Expected behavior

No crash

Actual outcome

Heap buffer overflow detected

Additional details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.