From: David Lively <dlively@virtualiron.com>
To: David Lively <dlively@virtualiron.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] xc_inflate_buffer fix
Date: Wed, 15 Mar 2006 14:59:23 -0500 [thread overview]
Message-ID: <4418721B.5040102@virtualiron.com> (raw)
In-Reply-To: <44185567.6070805@virtualiron.com>
Oops, forgot:
Signed-off-by: David Lively <dlively@virtualiron.com>
Dave
David Lively wrote:
> Hi -
> I notice some of my initrds are failing to gunzip:
> ERROR: inflate failed, sts -5
> These same initrds work fine with Ben Thomas' original
> patch introducing xc_{linux,hvm}_build_mem. The checked-in
> version changed some declarations from unsigned char * to
> char *, breaking the output length computation in xc_inflate_buffer.
> This patch assumes you want to keep using the signed char *
> for the interface, so it simply inserts a few casts to unsigned.
> Tested lightly, but the bug is pretty obvious once you notice
> the signedness change ...
>
> Dave
>
>
> ------------------------------------------------------------------------
>
> diff -r 1d741a415927 tools/libxc/xg_private.c
> --- a/tools/libxc/xg_private.c Wed Mar 15 11:48:33 2006 -0500
> +++ b/tools/libxc/xg_private.c Wed Mar 15 12:28:05 2006 -0500
> @@ -77,10 +77,11 @@ char *xc_inflate_buffer(const char *in_b
> return (char *)in_buf;
> }
>
> - out_len = in_buf[in_size-4] +
> - (256 * (in_buf[in_size-3] +
> - (256 * (in_buf[in_size-2] +
> - (256 * in_buf[in_size-1])))));
> + out_len = (unsigned char)in_buf[in_size-4] +
> + (256 * ((unsigned char)in_buf[in_size-3] +
> + (256 * ((unsigned char)in_buf[in_size-2] +
> + (256 * (unsigned char)in_buf[in_size-1])))));
> +
> bzero(&zStream, sizeof(zStream));
> out_buf = malloc(out_len + 16); /* Leave a little extra space */
> if ( out_buf == NULL )
next prev parent reply other threads:[~2006-03-15 19:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-15 17:56 [PATCH] xc_inflate_buffer fix David Lively
2006-03-15 19:59 ` David Lively [this message]
2006-03-17 10:38 ` Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4418721B.5040102@virtualiron.com \
--to=dlively@virtualiron.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.