[PATCH] Suppress wcsrtombs jump valgrind error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Suppress wcsrtombs jump valgrind error

Allan McRae
Add a suppression to avoid this error from valgrind:

==28835== Conditional jump or move depends on uninitialised value(s)
==28835==    at 0x57704E8: __gconv_transform_internal_ascii (in /usr/lib/libc-2.26.so)
==28835==    by 0x57ED5F5: wcsrtombs (in /usr/lib/libc-2.26.so)
==28835==    by 0x5782C41: wcstombs (in /usr/lib/libc-2.26.so)
==28835==    by 0x11461B: make_aligned_titles (package.c:143)
==28835==    by 0x11461B: dump_pkg_full (package.c:206)
==28835==    by 0x11B90E: sync_info (sync.c:415)
==28835==    by 0x11B90E: pacman_sync (sync.c:922)
==28835==    by 0x115F29: main (pacman.c:1290)
==28835==

Signed-off-by: Allan McRae <[hidden email]>
---

I think a supression is the way to go here...  It does not look like we do anything wrong.

 valgrind.supp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/valgrind.supp b/valgrind.supp
index 440b7318..1fea779d 100644
--- a/valgrind.supp
+++ b/valgrind.supp
@@ -109,6 +109,12 @@
    ...
    fun:regexec
 }
+{
+   wcsrtombs-goes-jump-jump
+   Memcheck:Cond
+   fun:__gconv_transform_internal_ascii
+   fun:wcsrtombs
+}
 {
    fakeroot-msgsnd
    Memcheck:Param
--
2.16.2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Suppress wcsrtombs jump valgrind error

Andrew Gregory
On 03/14/18 at 01:44pm, Allan McRae wrote:

> Add a suppression to avoid this error from valgrind:
>
> ==28835== Conditional jump or move depends on uninitialised value(s)
> ==28835==    at 0x57704E8: __gconv_transform_internal_ascii (in /usr/lib/libc-2.26.so)
> ==28835==    by 0x57ED5F5: wcsrtombs (in /usr/lib/libc-2.26.so)
> ==28835==    by 0x5782C41: wcstombs (in /usr/lib/libc-2.26.so)
> ==28835==    by 0x11461B: make_aligned_titles (package.c:143)
> ==28835==    by 0x11461B: dump_pkg_full (package.c:206)
> ==28835==    by 0x11B90E: sync_info (sync.c:415)
> ==28835==    by 0x11B90E: pacman_sync (sync.c:922)
> ==28835==    by 0x115F29: main (pacman.c:1290)
> ==28835==
>
> Signed-off-by: Allan McRae <[hidden email]>
> ---
>
> I think a supression is the way to go here...  It does not look like we do anything wrong.

We don't appear to initialized wbuf[i] anywhere.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Suppress wcsrtombs jump valgrind error

Allan McRae
On 14/03/18 14:43, Andrew Gregory wrote:

> On 03/14/18 at 01:44pm, Allan McRae wrote:
>> Add a suppression to avoid this error from valgrind:
>>
>> ==28835== Conditional jump or move depends on uninitialised value(s)
>> ==28835==    at 0x57704E8: __gconv_transform_internal_ascii (in /usr/lib/libc-2.26.so)
>> ==28835==    by 0x57ED5F5: wcsrtombs (in /usr/lib/libc-2.26.so)
>> ==28835==    by 0x5782C41: wcstombs (in /usr/lib/libc-2.26.so)
>> ==28835==    by 0x11461B: make_aligned_titles (package.c:143)
>> ==28835==    by 0x11461B: dump_pkg_full (package.c:206)
>> ==28835==    by 0x11B90E: sync_info (sync.c:415)
>> ==28835==    by 0x11B90E: pacman_sync (sync.c:922)
>> ==28835==    by 0x115F29: main (pacman.c:1290)
>> ==28835==
>>
>> Signed-off-by: Allan McRae <[hidden email]>
>> ---
>>
>> I think a supression is the way to go here...  It does not look like we do anything wrong.
>
> We don't appear to initialized wbuf[i] anywhere.
>

Ah...

This appears enough:

--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -92,7 +92,7 @@ static void make_aligned_titles(void)
        size_t maxlen = 0;
        int maxcol = 0;
        static const wchar_t title_suffix[] = L" :";
-       wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN +
ARRAYSIZE(title_suffix)];
+       wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN +
ARRAYSIZE(title_suffix)] = {{ 0 }};
        size_t wlen[ARRAYSIZE(wbuf)];
        int wcol[ARRAYSIZE(wbuf)];
        char *buf[ARRAYSIZE(wbuf)];