Re: [AD] Zero sized bitmaps

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> on it. Looking at the code, I can't for the life of me figure out why and
> after testing the following programme
> 
For me, on MSVC 8, if height is 0 it crashes at

destroy_bitmap()
{
....
   free(bitmap);   
}

with the message: HEEP CORRUPTION DETECTED: after Normal black (#804)
at 0x01B9ED00. CRT detected that the application wrote to the memory
after end of heap buffer.

If it's simply a MSVC bug, then there's no need to patch. 

However, the documentation says:

* The minimum height of the BITMAP must be 1 and width can't be negative
* Return value: Returns a pointer to the created bitmap, or NULL if
the bitmap could not be created.

To me, that implies that a height of 0 cannot be created and will return NULL.

So, I would lean toward your first patch of returning NULL. If nothing
is done, then the documentation should be updated to clarify what is
meant by "cannot be created."

--
Matthew Levertion




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/