Re: [AD] two things

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


Peter Wang wrote:

Perhaps it is just over-reading by a few bytes, due to us forgetting
about alignment or something.  What is the bitmap size you are loading?

#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>

int main() {
   al_init();
   al_init_image_addon();

   al_create_display(640, 480);
   al_load_bitmap("default_font.tga");

   return 0;
}

$ gcc -g2 -O0 test.c -o test `pkg-config --static --libs allegro_main-debug-static-4.9 allegro_image-debug-static-4.9`

$ valgrind --tool=memcheck ./test
...
==3668== Invalid read of size 1
==3668==    at 0x4028AA9: ???
==3668==  Address 0x55deffa is 0 bytes after a block of size 49,761 alloc'd
==3668== at 0x40228C9: calloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==3668==    by 0x807DA71: al_calloc_with_context (memory.c:83)
==3668==    by 0x80D3269: ogl_upload_bitmap (ogl_bitmap.c:564)
==3668==    by 0x8052A72: al_create_bitmap (bitmap.c:124)
==3668==    by 0x804DF80: _al_load_tga_f (tga.c:354)
==3668==    by 0x804E877: _al_load_tga (tga.c:539)
==3668==    by 0x8052589: al_load_bitmap (bitmap_io.c:219)
==3668==    by 0x804CA30: main (test.c:10)
==3668==
==3668== Invalid read of size 1
==3668==    at 0x4028AC4: ???
==3668==  Address 0x55deffb is 1 bytes after a block of size 49,761 alloc'd
==3668== at 0x40228C9: calloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==3668==    by 0x807DA71: al_calloc_with_context (memory.c:83)
==3668==    by 0x80D3269: ogl_upload_bitmap (ogl_bitmap.c:564)
==3668==    by 0x8052A72: al_create_bitmap (bitmap.c:124)
==3668==    by 0x804DF80: _al_load_tga_f (tga.c:354)
==3668==    by 0x804E877: _al_load_tga (tga.c:539)
==3668==    by 0x8052589: al_load_bitmap (bitmap_io.c:219)
==3668==    by 0x804CA30: main (test.c:10)




--
Milan Mimica
http://sparklet.sf.net

Attachment: default_font.tga
Description: Binary data



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