Heap Bug In JamesM's Tutorials
Posted: Tue Mar 10, 2009 3:17 pm
Hello,
I just wanted to say this for other developers using JamesM's tutorials. I'm not sure but, isn't this piece of code:
In chapter 7 (7.4.2.2. Allocation) supposed to be this:
Because JamesM checks if writing the footer of the hole will go past the ending address of the heap, but if the starting address of the hole footer is just before the ending address, but the structure's size reaches beyond the ending address, a page-fault will/might occur. So I think this is a bug.
Can you give me any feedback on this (I'm not really a guru in heap-related things).
I just wanted to say this for other developers using JamesM's tutorials. I'm not sure but, isn't this piece of code:
Code: Select all
if ((u32int)hole_footer < heap->end_address)
{
hole_footer->magic = HEAP_MAGIC;
hole_footer->header = hole_header;
}
Code: Select all
if (((u32int)hole_footer + sizeof(footer_t)) < heap->end_address)
{
hole_footer->magic = HEAP_MAGIC;
hole_footer->header = hole_header;
}
Can you give me any feedback on this (I'm not really a guru in heap-related things).