Test your malloc protection

Overview

Logo

Test your allocs protections and leaks ! Report Bug · Request Feature

Table of Contents
  1. About The Tool
  2. Getting Started
  3. Usage
  4. Contributing
  5. Contact

About The Tool

screenshot

This tool allows you to test if every allocs in your project are protected. It also checks if an alloc fail: if you free every allocations.

It also check leaks !

(back to top)

Getting Started

Here, you will see how to setup this tool in a example project.

Prerequisites

This is working out of the box on 42's VM

If your are not on the VM you will need those installed on your system.

Your CC must be clang

  • Linux
  • clang
  • llvm

Quickstart

  1. Clone the repo inside your project
    git clone https://github.com/tmatis/ft_mallocator.git
  2. Cd in directory
    cd ./ft_mallocator
  3. Execute script
    bash test.sh
  4. Follow script's instructions...

Demo video

record.mp4

(back to top)

Usage

Here we have an example of not well protected code:

char *malloc_function(void)
{
	return (malloc(1000));
}

int main(void)
{
	void *ptr = malloc_function();
	if (ptr == NULL)
		return (1);
	free(ptr);

	void *array[10];

	for (int i = 0; i < 10; i++)
	{
		array[i] = malloc(1000);
		if (array[i] == NULL)
		{
			printf("it fail %i\n", i);
			return (0);
		}
		memset(array[i], 0, 1000);
	}
	
	for (int i = 0; i < 10; i++)
		free(array[i]);

	ptr = malloc_function();
	memset(ptr, 0, 1000);
	free(ptr);
}

this exemples have many problems, let's run mallocator on it... screenshot

The first allocation is well protected nothing to say. The second alloction if protected but if a malloc crash not everythings is free. (At the second iteration of the for loop) The third allocation is not protected at all, there is no null check.

Let's see a well protected example..

char *malloc_function(void)
{
	return (malloc(1000));
}

int main(void)
{
	void *ptr = malloc_function();
	if (ptr == NULL)
		return (1);
	free(ptr);

	void *array[10];

	int i = 0;
	for (i = 0; i < 10; i++)
	{
		array[i] = malloc(1000);
		if (array[i] == NULL)
		{
			printf("it fail %i\n", i);
			break ;
		}
		memset(array[i], 0, 1000);
	}
	for (int j = 0; j < i; j++)
		free(array[j]);

	ptr = malloc_function();
	if (!ptr)
		return (1);
	memset(ptr, 0, 1000);
	free(ptr);
}

Then we run mallocator on this code ...

screenshot

This code is protected.

You can see how it is working behind the scene here.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Contact

tmatis's 42 stats

(back to top)

Owner
tmatis
Student
tmatis
jemalloc websitejemalloc - General purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. [BSD] website

jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. jemalloc first came

jemalloc memory allocator 7k May 14, 2022
A poggers malloc implementation

pogmalloc(3) A poggers malloc implementation Features Static allocator Real heap allocator (via sbrk(2)) Builtin GC Can also mark static memory Can be

Ariel Simulevski 1 Nov 3, 2021
Malloc Lab: simple memory allocator using sorted segregated free list

LAB 6: Malloc Lab Main Files mm.{c,h} - Your solution malloc package. mdriver.c - The malloc driver that tests your mm.c file short{1,2}-bal.rep - T

null 1 Feb 28, 2022
Custom implementation of C stdlib malloc(), realloc(), and free() functions.

C-Stdlib-Malloc-Implementation NOT INTENDED TO BE COMPILED AND RAN, DRIVER CODE NOT OWNED BY I, ARCINI This is a custom implmentation of the standard

Alex Cini 1 Dec 27, 2021
Hardened malloc - Hardened allocator designed for modern systems

Hardened malloc - Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.

GrapheneOS 715 May 12, 2022
Mimalloc-bench - Suite for benchmarking malloc implementations.

Mimalloc-bench Suite for benchmarking malloc implementations, originally developed for benchmarking mimalloc. Collection of various benchmarks from th

Daan 141 May 11, 2022
Test cpu and memory speed at linux-vps

Тест скорости процессора и памяти на linux-vps. Занимается бессмысленным перемножением массивов случайных чисел, для определения скорости процессора и

Anton 3 Nov 30, 2021
Alloc-test - Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical

Alloc-test - Cross-platform benchmarking for memory allocators, aiming to be as close to real world as it is practical

null 36 Mar 17, 2022
Test your malloc protection

Test your allocs protections and leaks ! Report Bug · Request Feature Table of Contents About The Tool Getting Started Prerequisites Quickstart Usage

tmatis 32 Apr 3, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.5k May 10, 2022
2020-1 KyungHee University information protection project

PGP Pretty Good Privacy의 약자로, 컴퓨터 파일을 암호화하고 복호화하는 프로그램입니다. Visual Studio 2019 기반으로 코드를 완성했고, PGP 동작 과정을 콘솔에 표현했습니다. PGP Transmission Mode의 Step 3 단계에서

Sungsu 4 May 17, 2021
Bypasses for Windows kernel callbacks PatchGuard protection

kernel_callbacks Bypasses for Windows kernel callbacks PatchGuard protection https://www.godeye.club/2021/08/14/001-windows-notification-callbacks.htm

Kento Oki 28 Mar 12, 2022
Real Time, High performance BOT detection and protection

REAL-TIME BOT PROTECTION CHALLENGE IronFox https://innovera.ir IronFox is a real-time and high performance bot protection, that using Nginx as a reve

Khalegh Salehi 3 May 7, 2022
An advanced in-memory evasion technique fluctuating shellcode's memory protection between RW/NoAccess & RX and then encrypting/decrypting its contents

Shellcode Fluctuation PoC A PoC implementation for an another in-memory evasion technique that cyclically encrypts and decrypts shellcode's contents t

Mariusz Banach 476 May 9, 2022
Blumentals Program Protector v4.x anti protection toolkit

VeNoM A Blumentals Program Protector v4.x anti protection toolkit. Reverse engineering proof-of-concept code. Screenshot & demo venomdemo.mp4 Usage Th

Aleksandar 3 Jan 10, 2022
Blumentals Program Protector v4.x protection bypass.

cphookLoader64 A Blumentals Program Protector v4.x protection bypass implemented as a memory loader. Screenshot & demo cphookloader64demo.mp4 Overview

Aleksandar 4 Jan 23, 2022
TestFrame - This is a test framework that uses Raylib and ImGui together to help test and develop concepts

This is a test framework that uses Raylib and ImGui together to help test and develop concepts. It is made using C++ because it uses classes for windows and views.

Jeffery Myers 20 Mar 5, 2022
The Hoard Memory Allocator: A Fast, Scalable, and Memory-efficient Malloc for Linux, Windows, and Mac.

The Hoard Memory Allocator Copyright (C) 1998-2020 by Emery Berger The Hoard memory allocator is a fast, scalable, and memory-efficient memory allocat

Emery Berger 882 May 13, 2022
jemalloc websitejemalloc - General purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. [BSD] website

jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. jemalloc first came

jemalloc memory allocator 7k May 14, 2022
Custom Malloc/Free implementation in C

To run the tests simply compile using "make" and run the executable "memory" with "./memory". The tests run automatically from main(), there are 3 tes

null 1 Dec 30, 2021
A poggers malloc implementation

pogmalloc(3) A poggers malloc implementation Features Static allocator Real heap allocator (via sbrk(2)) Builtin GC Can also mark static memory Can be

Ariel Simulevski 1 Nov 3, 2021
Malloc Lab: simple memory allocator using sorted segregated free list

LAB 6: Malloc Lab Main Files mm.{c,h} - Your solution malloc package. mdriver.c - The malloc driver that tests your mm.c file short{1,2}-bal.rep - T

null 1 Feb 28, 2022
Custom implementation of C stdlib malloc(), realloc(), and free() functions.

C-Stdlib-Malloc-Implementation NOT INTENDED TO BE COMPILED AND RAN, DRIVER CODE NOT OWNED BY I, ARCINI This is a custom implmentation of the standard

Alex Cini 1 Dec 27, 2021
Hardened malloc - Hardened allocator designed for modern systems

Hardened malloc - Hardened allocator designed for modern systems. It has integration into Android's Bionic libc and can be used externally with musl and glibc as a dynamic library for use on other Linux-based platforms. It will gain more portability / integration over time.

GrapheneOS 715 May 12, 2022
Mimalloc-bench - Suite for benchmarking malloc implementations.

Mimalloc-bench Suite for benchmarking malloc implementations, originally developed for benchmarking mimalloc. Collection of various benchmarks from th

Daan 141 May 11, 2022
Minimal implementation of malloc and free for demo purposes.

Minimal implementation of malloc and free using sbrk() and brk() system calls. Context: How does a process actually request the kernel to allocate/dea

Ritwick Dey 4 May 13, 2022
🧼 Cleanly pause and play your YouTube videos while cooking/crafting/doing your makeup by waving your hand over a proximity sensor!

?? Cleanly pause and play your YouTube videos while cooking/crafting/doing your makeup by waving your hand over a proximity sensor!

Tala Buwadi 10 May 1, 2022
Easily view the unexplored korok seeds and locations in your BotW savefile on your Switch

BotW Unexplored Easily view what hasn't been discovered in your Breath of the Wild savefile, on your Nintendo Switch. The korok seeds that haven't bee

Ludvig Magnusson 78 May 8, 2022