Skip to content

ExdiGdbSrv.dll BufferWrapper.h assert #126

@moso1

Description

@moso1

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions