memory-corruption

Output spits two extra control characters, possibly a memory corruption bug?

≯℡__Kan透↙ 提交于 2019-12-12 18:53:10
问题 I have the following program test.cc: #include <iostream> unsigned char bogus1[] = { // Changing # of periods (0x2e) changes output after periods. 0x2e, 0x2e, 0x2e, 0x2e }; unsigned int bogus2 = 1816; // Changing this value changes output. int main() { std::clog << bogus1; } I build it with: g++ -g -c -o test.o test.cc; g++ -static-libgcc -o test test.o Using g++ version 3.4.6 I run it through valgrind and nothing is reported wrong. However the output has two extra control characters and

GDB debugging trace with no relevant info (#0 0x2e6e6f69 in ?? ())

牧云@^-^@ 提交于 2019-12-12 00:55:32
问题 I am facing a specific challenge while debugging with GDB. My binary is generating core. When i am debugging it GDB. I am not getting relevant debugging information. GDB stack trace (bt):- [root@ussdgw5 bin]# gdb pull core.11328 GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO

AddressSanitizer Crash on GCC 4.8

China☆狼群 提交于 2019-12-11 02:15:32
问题 I've just tried out GCC 4.8's new exciting feature AddressSanitizer. The program #include <iostream> int main(int argc, const char * argv[], const char * envp[]) { int *x = nullptr; int y = *x; std::cout << y << std::endl; return 0; } compile find using g++-4.8 -std=gnu++0x -g -fsanitize=address -fno-omit-frame-pointer -Wall ~/h.cpp -o h but when I run the program I get ASAN:SIGSEGV ================================================================= ==7531== ERROR: AddressSanitizer crashed on

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

十年热恋 提交于 2019-12-10 03:43:45
问题 I really do not understand how is this error happening at this code. Please check the code yourself void dispatcherTimer_Tick(object sender, EventArgs e) { string srUrl = lstLocalIndex[irLocalIndex] + lstMainIndex[irMainIndex].Replace("0;",""); Task.Factory.StartNew(() => { startNewWindow(srUrl); }); } void startNewWindow(string srUrl) { NewWindowThread<TitleWindow, string>(c => new TitleWindow(c), srUrl); } Now this code is where the error happening. I will also attach screenshot private

boost::spirit::hold_any memory corruption

徘徊边缘 提交于 2019-12-09 01:18:43
问题 I have a large code base that can use boost::any or boost::spirit::hold_any (depending on a macro definition). hold_any seems to be compatible with boost::any (e.g. How to print boost::any to a stream? or Type erasure - Part IV) and faster (Why you shouldn’t use boost::any) but I'm experiencing several segmentation fault errors using hold_any (Boost v1.55 / 1.54 / 1.53). This is a minimal working example that exhibits the same problem as the original code: #include <iostream> #include <string

Debugging a nasty SIGILL crash: Text Segment corruption

夙愿已清 提交于 2019-12-08 19:30:00
问题 Ours is a PowerPC based embedded system running Linux. We are encountering a random SIGILL crash which is seen for wide variety of applications. The root-cause for the crash is zeroing out of the instruction to be executed. This indicates corruption of the text segment residing in memory. As the text segment is loaded read-only, the application cannot corrupt it. So I am suspecting some common sub-system (DMA?) causing this corruption. Since the problem takes days to reproduce (crash due to

Tool to debug buffer overflows in C++ program with Visual Studio? [closed]

别等时光非礼了梦想. 提交于 2019-12-05 22:50:31
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . A long time ago when I was doing C++ work on Windows, there was an advanced diagnostics tool for debugging buffer overflows. It initialized all allocated memory areas, stack or heap, with a special pattern of characters so it could detect buffer overflows. It injected itself into the memory manager to do this and also so it could check all memory areas after a memory write to look for corruption. In exhaustive

Valgrind gives an error for nearly everything (Warning: client switching stacks?)

荒凉一梦 提交于 2019-12-04 22:30:23
I'm corrupting memory somehow because my program crashes without error at random places. I'm using valgrind with --leak-check=full , compiling with -O0 -g , and the very first problem it detects is the first line in int main() cout << "reading file" << endl; with ==5089== Warning: client switching stacks? SP change: 0x7ff0004f8 --> 0x7feb7de10 ==5089== to suppress, use: --max-stackframe=4728552 or greater ==5089== Invalid write of size 8 ==5089== at 0x41E107: main (Dgn.cpp:2833) ==5089== Address 0x7feb7de08 is on thread 1's stack It goes on with ==5089== Invalid read of size 8 ==5089== at

Why does this code corrupt memory?

你。 提交于 2019-12-04 13:13:25
This is a fairly newbie question which should be answerable reasonably quickly... Basically, after the first call to Printf in echo , the contents of args is corrupted. It sounds to me like i'm passing the pointers around incorrectly. But can't figure out why? #define MAX_PRINT_OUTPUT 4096 void Echo(char *args[MAX_COMMAND_ARGUMENTS], int argCount) { for (int i = 1; i < argCount; ++i) { Printf("%s ", args[i]); Printf("\n"); } }; void Printf(const char *output, ...) { va_list args; char formattedOutput[MAX_PRINT_OUTPUT]; va_start(args, output); vsnprintf(formattedOutput, sizeof(formattedOutput),

Catching EngineExecutionException

 ̄綄美尐妖づ 提交于 2019-12-04 12:57:00
I have an application containing both managed and native code. The application currently has an unhandled exception filter, set via SetUnhandledExceptionFilter, which catches any critical errors, generates a minidump, records various application parameters, and exits the program. The unhandled exception handler does not catch an EngineExecutionException which occurs in the .NET runtime. We suspect the problem is memory corruption caused by the native portion of the application. The problem is, when the exception occurs, the application just exits without a trace. We'd like to record a minidump