https://bugs.kde.org/show_bug.cgi?id=472219

--- Comment #6 from fanqu...@gmail.com ---
(In reply to Paul Floyd from comment #4)
> This does look like a Valgrind bug:
> 
> The manpage says
> 
> The field fd contains a file descriptor for an open file. If this field is
> negative, then the corresponding events field is ignored and the revents
> field returns zero. (This provides an easy way of ignoring a file descriptor
> for a single poll() call: simply negate the fd field.) 
> 
> But we don't check for that:
> 
>    for (i = 0; i < ARG2; i++) {
>       PRE_MEM_READ( "ppoll(ufds.fd)",
>                     (Addr)(&ufds[i].fd), sizeof(ufds[i].fd) );
>       PRE_MEM_READ( "ppoll(ufds.events)",
>                     (Addr)(&ufds[i].events), sizeof(ufds[i].events) );
>       PRE_MEM_WRITE( "ppoll(ufds.revents)",
>                      (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
>    }
> 
> I think that should be
> 
>    for (i = 0; i < ARG2; i++) {
>       PRE_MEM_READ( "ppoll(ufds.fd)",
>                     (Addr)(&ufds[i].fd), sizeof(ufds[i].fd) );
>       if (ufds[i].fd >= 0) { 
>          PRE_MEM_READ( "ppoll(ufds.events)",
>                        (Addr)(&ufds[i].events), sizeof(ufds[i].events) );
>       }
>       PRE_MEM_WRITE( "ppoll(ufds.revents)",
>                      (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
>    }

Compiling master + your patch fixes the issue for me, using the test case
provided.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to