All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1.0?] qapi: Check for negative enum values
Date: Mon, 14 Nov 2011 11:58:14 -0600	[thread overview]
Message-ID: <4EC156B6.4060506@linux.vnet.ibm.com> (raw)
In-Reply-To: <20111114152920.37edca6f@doriath>

On 11/14/2011 11:29 AM, Luiz Capitulino wrote:
> We don't currently check for negative enum values in qmp_output_type_enum(),
> this will very likely generate a segfault when triggered.
>
> However, it _seems_ that no code in tree can trigger this today.
>
> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
> ---
>
> I think it's a good idea to merge this one for 1.0, but I'd be ok to queue it
> for 1.1 in case we're only merging fixes for "real" bugs.
>
> I found this while extending the QAPI's unit-tests...
>
>   qapi/qmp-output-visitor.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
> index d67724e..f76d015 100644
> --- a/qapi/qmp-output-visitor.c
> +++ b/qapi/qmp-output-visitor.c
> @@ -190,7 +190,7 @@ static void qmp_output_type_enum(Visitor *v, int *obj, const char *strings[],
>
>       assert(strings);
>       while (strings[i++] != NULL);
> -    if (value>= i - 1) {
> +    if (value<  0 || value>= i - 1) {
>           error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");
>           return;
>       }

Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>

      reply	other threads:[~2011-11-14 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 17:29 [Qemu-devel] [PATCH 1.0?] qapi: Check for negative enum values Luiz Capitulino
2011-11-14 17:58 ` Michael Roth [this message]

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=4EC156B6.4060506@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.