[Top][All Lists]

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

Re: GUB and mpfr/mpc

From: David Kastrup
Subject: Re: GUB and mpfr/mpc
Date: Sat, 01 Nov 2014 13:59:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Masamichi HOSODA <address@hidden> writes:

> How about this patch?
> --- librestrict/       2014-10-19 09:52:52.951262300 +0900
> +++ librestrict/xstatconv.c   2014-11-01 20:26:35.734854500 +0900
> @@ -48,20 +48,16 @@
>        {
>       struct stat *buf = ubuf;
> +     /* zero clear */
> +     memset(buf, 0, sizeof(*buf));
>       /* Convert to current kernel version of `struct stat'.  */
>       buf->st_dev = kbuf->st_dev;

On the surface of it, this looks very reasonable.  However, since
everything is guarded with #ifdef and similar and the definitions are
probably generated by autoconf, it would appear that different versions
of stat.h are employed in the compilation and the resulting mismatch of
definitions and structures (possibly between host and target
definitions) could lead to crashes and memory corruption.

So it would seem like a good idea to first figure out what goes wrong
here before fixing it in this manner.  It might be a nice fix (and the
code certainly looks nicer for it) but I have no idea if it is correct.
The "if it were that easy, it would have been written like that in the
first place" mantra may be wrong surprisingly often, but it would still
be nice to make sure.

David Kastrup

reply via email to

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