Re: [AD] SF.net SVN: alleg:[11645] allegro/branches/4.9/examples/ex_utf8.c |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] SF.net SVN: alleg:[11645] allegro/branches/4.9/examples/ex_utf8.c
- From: Elias Pschernig <elias.pschernig@xxxxxxxxxx>
- Date: Sun, 22 Feb 2009 00:05:16 +0100
On Sun, 2009-02-22 at 09:36 +1100, Peter Wang wrote:
> On 2009-02-21, elias@xxxxxxxxxx <elias@xxxxxxxxxx> wrote:
> > Revision: 11645
> > http://alleg.svn.sourceforge.net/alleg/?rev=11645&view=rev
> > Author: elias
> > Date: 2009-02-21 15:43:42 +0000 (Sat, 21 Feb 2009)
> >
> > Log Message:
> > -----------
> > Added a testcase to ex_utf8 which crashes for me. Peter: Waiting for you to fix it before I start debugging it myself :)
> >
>
> I can't reproduce it.
>
> Peter
>
> % valgrind ./ex_utf8 46
> ==15887== Memcheck, a memory error detector.
> ==15887== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
> ==15887== Using LibVEX rev 1878, a library for dynamic binary translation.
> ==15887== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
> ==15887== Using valgrind-3.4.0, a dynamic binary instrumentation framework.
> ==15887== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
> ==15887== For more details, rerun with: -v
> ==15887==
> OK 0 == strcmp(al_cstr(us), "hõljuk c 42")
> OK al_ustr_appendf(us, " %s", "Luftchüssiboot")
> OK 0 == strcmp(al_cstr(us), "hõljuk c 42 Luftchüssiboot")
> OK call_vappendf(us, " %s", "χόβερκράφτ")
> OK 0 == strcmp(al_cstr(us), "hõljuk c 42 Luftchüssiboot χόβερκράφτ")
> ==15887==
> ==15887== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 59 from 1)
> ==15887== malloc/free: in use at exit: 0 bytes in 0 blocks.
> ==15887== malloc/free: 7 allocs, 7 frees, 152 bytes allocated.
> ==15887== For counts of detected errors, rerun with: -v
> ==15887== All heap blocks were freed -- no leaks are possible.
>
Ok, I'll try to figure it out here then. Very strange though - this is
what I get:
> valgrind ./ex_utf8 46
==19793== Memcheck, a memory error detector.
==19793== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==19793== Using LibVEX rev 1878, a library for dynamic binary translation.
==19793== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==19793== Using valgrind-3.4.0-Debian, a dynamic binary instrumentation framework.
==19793== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==19793== For more details, rerun with: -v
==19793==
==19793== Invalid read of size 1
==19793== at 0x4C23092: strlen (mc_replace_strmem.c:242)
==19793== by 0x66BFCB0: vfprintf (in /lib/libc-2.7.so)
==19793== by 0x66E5209: vsnprintf (in /lib/libc-2.7.so)
==19793== by 0x438ABE: _al_bvcformata (bstrlib.c:2938)
==19793== by 0x430DD7: al_ustr_vappendf (utf8.c:470)
==19793== by 0x43032D: al_ustr_newf (utf8.c:76)
==19793== by 0x42E70E: t46 (ex_utf8.c:996)
==19793== by 0x42F322: main (ex_utf8.c:1134)
==19793== Address 0x2e is not stack'd, malloc'd or (recently) free'd
==19793==
==19793== Process terminating with default action of signal 11 (SIGSEGV)
==19793== Access not within mapped region at address 0x2E
==19793== at 0x4C23092: strlen (mc_replace_strmem.c:242)
==19793== by 0x66BFCB0: vfprintf (in /lib/libc-2.7.so)
==19793== by 0x66E5209: vsnprintf (in /lib/libc-2.7.so)
==19793== by 0x438ABE: _al_bvcformata (bstrlib.c:2938)
==19793== by 0x430DD7: al_ustr_vappendf (utf8.c:470)
==19793== by 0x43032D: al_ustr_newf (utf8.c:76)
==19793== by 0x42E70E: t46 (ex_utf8.c:996)
==19793== by 0x42F322: main (ex_utf8.c:1134)
==19793== If you believe this happened as a result of a stack overflow in your
==19793== program's main thread (unlikely but possible), you can try to increase
==19793== the size of the main thread stack using the --main-stacksize= flag.
==19793== The main thread stack size used in this run was 8388608.
==19793==
==19793== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 10 from 1)
==19793== malloc/free: in use at exit: 81,429 bytes in 31 blocks.
==19793== malloc/free: 128 allocs, 97 frees, 135,072 bytes allocated.
==19793== For counts of detected errors, rerun with: -v
==19793== searching for pointers to 31 not-freed blocks.
==19793== checked 5,253,616 bytes.
==19793==
==19793== LEAK SUMMARY:
==19793== definitely lost: 0 bytes in 0 blocks.
==19793== possibly lost: 0 bytes in 0 blocks.
==19793== still reachable: 81,429 bytes in 31 blocks.
==19793== suppressed: 0 bytes in 0 blocks.
==19793== Rerun with --leak-check=full to see details of leaked memory.
Segmentation fault
gdb says this:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff62b8030 in strlen () from /lib/libc.so.6
(gdb) bt full
#0 0x00007ffff62b8030 in strlen () from /lib/libc.so.6
No symbol table info available.
#1 0x00007ffff6284cb1 in vfprintf () from /lib/libc.so.6
No symbol table info available.
#2 0x00007ffff62aa20a in vsnprintf () from /lib/libc.so.6
No symbol table info available.
#3 0x0000000000438abf in _al_bvcformata (b=0x6d4f40, count=12, fmt=0x48c190 "%s %c %02d", arg=0x7fffffffe280)
at /home/elias/prog/allegro/4.9/src/misc/bstrlib.c:2938
n = 12
r = 12
l = 12
#4 0x0000000000430dd8 in al_ustr_vappendf (us=0x6d4f40, fmt=0x48c190 "%s %c %02d", ap=0x7fffffffe280)
at /home/elias/prog/allegro/4.9/src/utf8.c:470
sz = 12
rc = -12
#5 0x000000000043032e in al_ustr_newf (fmt=0x48c190 "%s %c %02d") at /home/elias/prog/allegro/4.9/src/utf8.c:76
us = (ALLEGRO_USTR *) 0x6d4f40
ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffffffe360, reg_save_area = 0x7fffffffe2a0}}
#6 0x000000000042e70f in t46 () at /home/elias/prog/allegro/4.9/examples/ex_utf8.c:996
us = (ALLEGRO_USTR *) 0x0
#7 0x000000000042f323 in main (argc=2, argv=0x7fffffffe478) at /home/elias/prog/allegro/4.9/examples/ex_utf8.c:1134
i = 46
And apparently, it crashes not in the code I added but before now :/
Very odd, I best start by doing a fresh checkout...
--
Elias Pschernig <elias@xxxxxxxxxx>