pageheap

Debug Visual C++ memory allocation problems

自作多情 提交于 2019-12-20 06:11:15
问题 I'm debugging a software which crashes eventually with one of the following messages: 1. DAMAGE: after normal block (#24729280) at 0x00D710E0 2. Debug Assertion Failed Program: D:\Soft\Test.exe File: dbgheap.c Line: 1017 Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse) This software is really old but changing it now is not an option. It's written on Visual C++ 6.0. We are guessing it's some kind of buffer overflow, so we are trying to find ways to detect where it is happening. I have found

gethostbyname API fails when App Verifier is on

折月煮酒 提交于 2019-12-08 01:59:17
问题 I ran into a problem trying to test an application under Application Verifier with Page Heap on. It turns out that gethostbyname API always fails even for legit host names like "localhost". The problem reproduces on every Win-7 or Server 2008 R2 I tried even for a very simple test applications using gethostbyname. Repro steps: in appverifier check "page heap" and "UseLFGGuard..." checkboxes, run any app using gethostbyname(..). Example of application code (prints "127.0.0.1" when appverifier

Microsoft's strncat reads bytes beyond source buffer boundaries

元气小坏坏 提交于 2019-12-07 04:38:07
问题 I observe an interesting problem with the Microsoft implementation of strncat . It touches 1 byte beyond the source buffer. Consider the following code: #include <stdio.h> #include <stdlib.h> #include <memory.h> #include <string.h> void main() { char dstBuf[1024]; char* src = malloc(112); memset(src, 'a', 112); dstBuf[0] = 0; strncat(dstBuf, src, 112); } strncat reads 1 byte after 112 byte block. So if you are unlucky enough to get allocation on an invalid page boundary, your application

gethostbyname API fails when App Verifier is on

偶尔善良 提交于 2019-12-06 09:17:13
I ran into a problem trying to test an application under Application Verifier with Page Heap on. It turns out that gethostbyname API always fails even for legit host names like "localhost". The problem reproduces on every Win-7 or Server 2008 R2 I tried even for a very simple test applications using gethostbyname. Repro steps: in appverifier check "page heap" and "UseLFGGuard..." checkboxes, run any app using gethostbyname(..). Example of application code (prints "127.0.0.1" when appverifier is off, "getaddrinfo failed" when appverifier is on): #include <winsock2.h> #include <ws2tcpip.h>

Debug Visual C++ memory allocation problems

柔情痞子 提交于 2019-12-02 10:12:07
I'm debugging a software which crashes eventually with one of the following messages: 1. DAMAGE: after normal block (#24729280) at 0x00D710E0 2. Debug Assertion Failed Program: D:\Soft\Test.exe File: dbgheap.c Line: 1017 Expression: _BLOCK_TYPE_IS_VALID(phead->nBlockUse) This software is really old but changing it now is not an option. It's written on Visual C++ 6.0. We are guessing it's some kind of buffer overflow, so we are trying to find ways to detect where it is happening. I have found information about PageHeap (which seems to be able to tell me what I want) and GFlags , but it seems I