microsoft / microsoft/WinDbg-Samples

ExdiGdbSrv.dll BufferWrapper.h assert

Open
#126 1 comment 0 reactions 1 assignee View on GitHub

@alexsmendez is already working on this.

Since Sep 25, 2025.

Dominant language
C++
Stars
827
Forks
135
PR merge metrics
No merged PRs in 30d

Description

I'm exercising !uefiext.init command over EXDI and WinDbg pops up a assert dialog many times as attached.

I build my own ExdiGdbSrv.dll, attach to EngHost.exe to get this callstack:

>	ExdiGdbSrv.dll!common_assert_to_message_box<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 388	C++
 	ExdiGdbSrv.dll!GdbSrvControllerLib::BufferWrapper<char>::SetLength(unsigned __int64 newLength) Line 74	C++
 	ExdiGdbSrv.dll!GdbSrvControllerLib::GdbSrvController::GdbSrvControllerImpl::ReadMemory(unsigned __int64 address, unsigned __int64 maxSize, const GdbSrvControllerLib::memoryAccessType memType) Line 1677	C++
 	ExdiGdbSrv.dll!GdbSrvControllerLib::GdbSrvController::ReadMemory(unsigned __int64 address, unsigned __int64 size, const GdbSrvControllerLib::memoryAccessType memType) Line 3438	C++
 	ExdiGdbSrv.dll!CLiveExdiGdbSrvServer::ReadVirtualMemory(__int64 Address, unsigned long dwBytesToRead, tagSAFEARRAY * * pbReadBuffer) Line 537	C++
 	[External Code]	
 	uefiext.dll!FindModuleBackwards(unsigned __int64 Address) Line 81	C++
 	uefiext.dll!findall(IDebugClient4 * Client, const char * args) Line 256	C++
 	[External Code]	
 	uefiext.dll!uefiext_init(IDebugClient4 * Client, const char * args) Line 241	C++
 	[External Code]	

The point of interest is this line of code in GdbSrvControllerLib.cpp:

        size_t maxReplyLength = (maxSize * 2) + 256;
        if (!result.TryEnsureCapacity(maxReplyLength))
...		
                    result.SetLength(result.GetLength() + 1);

Why set 'result' length to larger than initialized?

Image

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.