You are here: start »

Bunny

As you might have noticed quite a few people are currently drawing pictures of bunny as a part of the Draw a Bunny Campaign which I was invited to by chimeric. This campaign has the following simple rules and is open to everyone:

  1. Draw a Bunny (or more)
  2. Post it to your blog with the rules
  3. Name three other bloggers that should draw a bunny

Sadly, after all the sudden fame bunny has become alienated from his natural habitat. Not knowing how to handle all the sudden attention and stress he chose the only way he saw to escape it all…

Bunny will be missed. If you want to see him again in his brightest moments don't forget about the greatest works of his short but brilliant acting career.

Rest In Peace.

EDIT: Tagged rebugger

2009/01/11 00:24 · demod · 0 Comments · 0 Linkbacks

I've got mail

The yes men got a nice way of saying thanks for donations – especially regarding the $3.75 postage from NY to germany :-D

2009/01/10 17:05 · demod · 2 Comments · 0 Linkbacks

demod's guide to gaming consoles (part 2 of 2)

In this part I will take a look at the games available for each system – lets start with some statistics.

→ Read more...

2008/12/06 17:24 · demod · 3 Comments · 0 Linkbacks

demod's guide to gaming consoles (part 1 of 2)

My GF and I recently bought a Playstation 3 and this was supposed to become a small review of it; however, a review by itself is often pretty useless if its subject is not directly compared to its competitors. Therefore I've added information about the other consoles on the market which is more or less the same set of knowledge that we used to base our decision on.

I hope that I've managed to keep the comparison fair and balanced; however, I can't guarantee it since we only own a Wii and a PS3. Therefore I had to rely on a friend and the net for information about the Xbox 360 – should I've missed something essential or got something wrong → please write a comment.

→ Read more...

2008/12/02 17:09 · demod · 0 Comments · 0 Linkbacks

Heap smashing thesis-code

Today I stumbled across a piece of C code I wrote to illustrate some properties of the glibc's dynamic memory allocator1) in my (german) bachelor thesis and figured that the code might actually turn out to be interesting for people seeking to understand or to toy with their heap. If you've never tried to understand your dynamic memory manager this code alone probably won't explain much; however, toying with something you don't understand might not be the worst starting point to change that ,)

The code was written to run on both x86 and x86-64 and to work with glibc versions between 2.3.3 and 2.7; however, other versions might work as well. To the C-coders reading this: sorry for the camelCase and the use of vowels in my identifiers, just couldn't help it after years of python&co ,)

heap_fastbin.c

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
 
#define CHUNK_OFFSET  (2 * sizeof(size_t))
#define printFastbinList(addr)  printBinList(addr, NULL)
 
void* chunk2mem(void* ptr) {
	return ptr + CHUNK_OFFSET;
}
 
void* mem2chunk(void* ptr) {
	return ptr - CHUNK_OFFSET;
}
 
void printChunkAddress(void* ptr, char* name) {
	printf("%s:\tchunk 0x%08lx\n", name, mem2chunk(ptr));
}
 
void printBinList(long* ptr, long* abort) {
	int i = 10;
 
	ptr = mem2chunk(ptr);
 
	if(abort)
		abort = mem2chunk(abort);
 
	printf("bin list: ");
	printf("0x%08lx -> ", ptr);
 
	while(1) {
		if(i-- <= 0) {
			printf("...");
			break;
		}
		// get the address of the next chunk
		ptr = chunk2mem(ptr);
		ptr = (long*) *ptr;
 
		if(ptr == abort) {
			printf("0x%08lx", ptr);
			break;
		}
 
		printf("0x%08lx -> ", ptr);
		fflush(stdout);
	}
	puts("");
}
 
int main(void) {
	size_t size = 0xf;
 
	long* ptr;
	long* tmp;
	int i;
 
	// #1: allocating chunks
	long* x = malloc(size);
	printChunkAddress(x, "x");
 
	long* a = malloc(size);
	long* b = malloc(size);
	long* c = malloc(size);
	printChunkAddress(a, "a");
	printChunkAddress(b, "b");
	printChunkAddress(c, "c");
 
	// #2: freeing a, b, c
	free(a);
	free(b);
	free(c);
 
	puts("\n--8<-- the fastbin before the double-free");
	printFastbinList(c);
 
	// #3: freeing b again
	free(b);
 
	puts("\n--8<-- the fastbin after the double-free");
	printFastbinList(c);
 
	// #4: reallocating b
	b = malloc(size);
 
	// #5: inserting x into the list
	*b = (long) mem2chunk(x);
	*x = (long) mem2chunk(a);
 
	puts("\n--8<-- the manipulated fastbin");
	printFastbinList(c);
 
	// #6: allocating chunks from the manipulated fastbin
	puts("\n--8<-- chunks returned by malloc");
 
	for(i=0; i < 5; i++) {
		ptr = malloc(size);
		printChunkAddress(ptr, "ptr");
	}
 
	exit(0);
}

→ Read more...

2008/10/15 16:31 · demod · 2 Comments · 0 Linkbacks

<< Newer entries | Older entries >>

blog.txt · Last modified: 2008/12/06 17:38 by demod