[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libidn-1.21 failed test tst_idna2

From: Simon Josefsson
Subject: Re: libidn-1.21 failed test tst_idna2
Date: Mon, 25 Apr 2011 21:20:35 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux)

Guido Trentalancia <address@hidden> writes:

> Hello Simon !

Hi!  I re-added help-libidn on the cc list, please keep it so that
others can learn from our discussion.

> Here is the output with -g added:
> ==31295== Invalid read of size 4
> ==31295==    at 0x402E46: idna_to_ascii_4z (idna.c:516)
> ==31295==  Address 0x51ca8d8 is 8 bytes inside a block of size 10
> alloc'd
> ==31295==    at 0x4C282CD: malloc (vg_replace_malloc.c:236)
> ==31295==    by 0x402F90: idna_to_ascii_4z (idna.c:528)
> Using only -g in the CFLAGS and dropping all the rest (-O3 and
> processor-specific optimisations) produces no errors.
> The problem is triggered by -O3, -O2 but not -O1.

That offending line contains a strlen.  I think this is just a matter of
the compiler chosing a (too) optimized 'strlen' implementation that
reads in chunks of 4 bytes even when the buffer is shorter.  In this
case, it reads 4 + 4 + 4 bytes but the buffer is only 10 bytes

It could be a compiler bug, but I suspect it is intentional to read even
beyond the end of a buffer because it will be faster.  Thus, unless it
is a compiler bug, you need to compile with the default compiler flags
or specify --disable-valgrind-tests when building libidn.

I hope this answers everything.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]