Debug heap useful for tracking down memory errors.

Related tags

Debug ig-debugheap
Overview

ig-debugheap - A debugging heap

This is a debug heap useful when trying to track down memory errors (especially on Windows, where there's no Valgrind.) It is written in C, and works on Mac, Linux and Windows.

This package provides the following features:

  • Array indexing errors (positive) trigger crashes, because allocations are aligned as closely as possible up to an inaccessible virtual memory page.

  • Using memory after freeing it triggers a crash most of the time.

  • Double frees are detected most of the time.

  • Unsynchronized multi-threaded access is detected.

To improve the chances of crashing on use-after-free or double frees, increase the size of the heap. Freed blocks are kept on an "observation list" for as long as possible to flush out these error classes, but it will eventually be reused.

This heap is terribly slow, and wastes tons of memory. You only want to use it to track down memory errors. One neat way of doing that is to provide a heap interface that can dynamically switch to this heap, maybe with a configuration option. You can then hunt for memory errors without recompiling.

License

Copyright (c) 2014, Insomniac Games All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You might also like...
A tool for tracking memory allocation based ld-preload

libmallocTrace A tool for tracking memory allocation based ld-preload how to build make cd example && make how to use a simple way is to execute some

Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be useful for remote visualization/debugging.

shared-memory-example Using shared memory to communicate between two executables or processes, for Windows, Linux and MacOS (posix). Can also be usefu

🍦 Never use cout/printf to debug again

IceCream-Cpp IceCream-Cpp is a little (single header) library to help with the print debugging on C++11 and forward. Try it at godbolt! Contents Insta

ScyllaHide for IDA7.5; ScyllaHide IDA7.5; It is a really niccccccce anti-anti-debug tool
ScyllaHide for IDA7.5; ScyllaHide IDA7.5; It is a really niccccccce anti-anti-debug tool

Hint 支持原项目,谢谢原项目作者,我只是改了改代码,以支持IDA7.5 ( 原本只支持IDA6.8 )。我觉得原作者应该会介意。 有事麻烦联系我删除。sorry Thank you for the original project developer ScyllaHide Thanks、Than

Mecha allows you to debug, study, and modify the League of Legends client
Mecha allows you to debug, study, and modify the League of Legends client

Mecha allows you to debug, study, and modify the League of Legends client Usage To use Mecha, you must compile it first. See this for more information

Class containing Anti-RE, Anti-Debug and Anti-Hook methods. Made for C++/CLI

Umium Class containing Anti-RE, Anti-Debug and Anti-Hook methods. Easy to use and easy to implement. Disclaimer This code has been made and optimized

Hypervisor based anti anti debug plugin for x64dbg
Hypervisor based anti anti debug plugin for x64dbg

HyperHide Table of Contents Description Compilation Support Usage Information Examples Features 1. Process Environment Block (PEB) 2. Heap Flags 3. Pr

A fork of Picoprobe, an SWD progammer firmware, for the Pico Debug'n'Dump

pdnd-picoprobe A fork of Picoprobe, an SWD progammer firmware, for the Pico Debug'n'Dump. Usage Make sure the "Mode" switch is set to I2C/SWD Follow g

debug esp32-c3 Ai-thinker board in platformio
debug esp32-c3 Ai-thinker board in platformio

Platformio Ai-thinker esp32-c3 project template with ability to debug using builtin USB JTAG. To be able to view periph regs while debugging, you need

Compile and run/debug C or C++ code easily

run-c Compile and run/debug C or C++ code easily. Installation and Updating Install & Update Script To install or update run-c, you should run the ins

designed for debug Espressif's ESP series chips, include ESP32/ESP32-S2/ESP32-C3/ESP32-S3...
designed for debug Espressif's ESP series chips, include ESP32/ESP32-S2/ESP32-C3/ESP32-S3...

ESPLink 中文 ESPLink Introduce Features Pin Description esplink-tool Product Link Reference ESPLink Introduce ESPLink is a debug tool build for Expressi

An Arduino library with additions to vanilla Serial.print(). Chainable methods and verbosity levels. Suitable for debug messages.

advancedSerial This library provides some additions to vanilla Serial.print(): 1. Chainable print() and println() methods: // you can chain print() a

Visual Studio native debugger extension to help debug native applications using Mono.
Visual Studio native debugger extension to help debug native applications using Mono.

Unity Mixed Callstack UnityMixedCallstack is a Visual Studio 2017/2019 extension to help debug native applications embedding Mono, like Unity. If you

An immediate-mode, renderer agnostic, lightweight debug drawing API for C++
An immediate-mode, renderer agnostic, lightweight debug drawing API for C++

Debug Draw An immediate-mode, renderer agnostic, lightweight debug drawing API for C++. License This software is in the public domain. Where that dedi

Stripped down version of BIGTREETECH-TouchScreenFirmware which only supports ST7920 emulation (Marlin Mode)

Stripped down version of BIGTREETECH-TouchScreenFirmware which only supports ST7920 emulation (Marlin Mode). This project only uses peripheral drivers supplied by the screen manufacturer and uses it's own library to parse the ST7920 commands.

Project 1945 is a top down scroller game made with SDL2, CMake and programmed in C as a project of study for the Italian Videogames Academy for the 3rd year course of Videogames programming.
Project 1945 is a top down scroller game made with SDL2, CMake and programmed in C as a project of study for the Italian Videogames Academy for the 3rd year course of Videogames programming.

Project 1945 is a top down scroller game made with SDL2, CMake and programmed in C as a project of study for the Italian Videogames Academy for the 3rd year course of Videogames programming. The game is based on the old videogame 1945: The Final Front of the 2002.

ByteCopy , or BCP, intends to copy files accurately (down to the bytes) in a simple , safe and efficient manner.

ByteCopy v3.6 About ByteCopy , or BCP, intends to copy files accurately (down to the bytes) in a simple , safe and efficient manner. It's functionalit

Photon, an Image Manipulation Language. A stripped-down subset of C, coded in OCaml.

Photon, an Image Manipulation Language Coded in OCaml, this takes a highly stripped-down subset of C (ints, bools, and void types, arithmetic, if-els

A cross-platform, top-down 2D space shooter written in C using only system libraries.
A cross-platform, top-down 2D space shooter written in C using only system libraries.

A cross-platform, top-down 2D space shooter written in C using only system libraries.

Comments
  • C89 does not allow //-comments

    C89 does not allow //-comments

    Hello,

    This looks like a fun and useful project, especially since you seem to want it to work C89 compatible.

    //-comments are however not C89 kosher so your code is unfortunately not C89 clean just yet!

    opened by bagder 8
  • Overflow bug in DebugHeapFree

    Overflow bug in DebugHeapFree

    Hej, Andreas :)

    There is an overflow bug in DebugHeapFree.

    This: page_index = (uint32_t) relative_offset / kPageSize; Should be: page_index = (uint32_t) (relative_offset / kPageSize);

    Cheers, Graham

    opened by gwihlidal 1
Owner
Andreas Fredriksson
Andreas Fredriksson
Anti-Debug and Anti-Memory Dump for Android

AntiDebugandMemoryDump Anti-Debug and Anti-Memory Dump for Android Some known techniques for anti-debug and anti-memory dump have been used in this pr

Darvin 183 Nov 21, 2022
Hypervisor based anti anti debug plugin for x64dbg

HyperHide Table of Contents Description Compilation Support Usage Information Examples Features 1. Process Environment Block (PEB) 2. Heap Flags 3. Pr

Air 632 Nov 15, 2022
heaptrace is a ptrace-based debugger for tracking glibc heap operations in ELF64 (x86_64) binaries

heaptrace is a ptrace-based debugger for tracking glibc heap operations in ELF64 (x86_64) binaries. Its purpose is to help visualize heap operations when debugging binaries or doing heap pwn.

Aaron Esau 249 Nov 9, 2022
Tool for profiling heap usage and memory management

vizzy > ./build/vizzytrace /tmp/heapinfo.trace /bin/find /home/zznop -name vizzy _ _ ____ ____ ____ _ _ ( \/ )(_ _)(_ )(_ )( \/ ) \ /

Brandon Miller 28 Jul 22, 2022
Replacements to standard numeric types which throw exceptions on errors

safe_numerics Arithmetic operations in C++ are NOT guaranteed to yield a correct mathematical result. This feature is inherited from the early days of

Boost.org 191 Nov 11, 2022
Anti-Debug and Anti-Memory Dump for Android

AntiDebugandMemoryDump Anti-Debug and Anti-Memory Dump for Android Some known techniques for anti-debug and anti-memory dump have been used in this pr

Darvin 183 Nov 21, 2022
PoC for CVE-2021-3156 (sudo heap overflow)

CVE-2021-3156 PoC for CVE-2021-3156 (sudo heap overflow). Exploit by @gf_256 aka cts. Thanks to r4j from super guesser for help. Credit to Braon Samed

Stephen Tong 431 Nov 9, 2022
A ring buffer designed to work with embedded devices, does not use heap allocations.

Embedded Ring Buffer This is a header only ring buffer that is designed to work on embedded devices, it is able to handle non-blocking ISR spooling

Richard Bamford 48 Aug 9, 2022
Simple min heap timer

KTimer simple useable heap timer . Samples #include "ktimer.h" ktimer::KTimer<std::chrono::seconds, std::mutex> myTimer ; //default ktimer::KTimer<>

cageq 4 Oct 7, 2021
A single file drop-in memory leak tracking solution for C++ on Windows

MemLeakTracker A single file drop-in memory leak tracking solution for C++ on Windows This small piece of code allows for global memory leak tracking

null 22 Jul 18, 2022