--- Begin Message ---
Subject: |
libidn11:amd64: invalid read of size 4 in idna_to_ascii_8z/idna_to_ascii_4z reported by valgrind |
Date: |
Sun, 22 Sep 2013 19:50:28 +0200 |
User-agent: |
KMail/4.10.5 (Linux/3.10-3-amd64; KDE/4.10.5; x86_64; ; ) |
Package: libidn11
Version: 1.28-1
Severity: normal
Dear Maintainer,
compiling and running a C program using valgrind leads to 'invalid read of
size 4' report.
The code snippet is
#include <stdio.h>
#include <idna.h>
void main(void)
{
char *host_asc = NULL;
idna_to_ascii_8z("www.exampl.com", &host_asc, IDNA_USE_STD3_ASCII_RULES);
printf("->%s\n",host_asc);
}
Compiling it with gcc 4.8.1-10 and executing the executable with
valgrind ./x
leads to
==8903== Invalid read of size 4
==8903== at 0x4E386A2: idna_to_ascii_4z (in /usr/lib/x86_64-linux-
gnu/libidn.so.11.6.11)
==8903== by 0x4E38919: idna_to_ascii_8z (in /usr/lib/x86_64-linux-
gnu/libidn.so.11.6.11)
==8903== by 0x400642: main (in /home/tim/src/mget/tmp/x)
==8903== Address 0x54121c8 is 8 bytes inside a block of size 11 alloc'd
==8903== at 0x4C2B72E: realloc (vg_replace_malloc.c:662)
==8903== by 0x4E3870D: idna_to_ascii_4z (in /usr/lib/x86_64-linux-
gnu/libidn.so.11.6.11)
==8903== by 0x4E38919: idna_to_ascii_8z (in /usr/lib/x86_64-linux-
gnu/libidn.so.11.6.11)
==8903== by 0x400642: main (in /home/tim/src/mget/tmp/x)
Using www.example.com (or any string with one byte longer) does not trigger
valgrind.
The printf() prints in both cases the expected result.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.10-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libidn11:amd64 depends on:
ii libc6 2.17-92+b1
ii multiarch-support 2.17-92+b1
libidn11:amd64 recommends no packages.
libidn11:amd64 suggests no packages.
-- no debconf information
signature.asc
Description: This is a digitally signed message part.
--- End Message ---
--- Begin Message ---
Subject: |
Closing as this is not a bug in libidn |
Date: |
Sun, 4 May 2014 10:28:17 +0200 |
The cause is gcc optimization of glibc code. The optimization is
probably something that we want to happen. So the consequence is that
valgrind complains, and the proper fix is likely to silence valgrind by
adding a global suppression about this kind of error. Closing this
since it is not about libidn per se.
/Simon
--- End Message ---