All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH] gvariant: Exclude container's offsets from child iterator len.
Date: Mon, 21 Mar 2016 12:57:17 -0500	[thread overview]
Message-ID: <56F035FD.2050301@gmail.com> (raw)
In-Reply-To: <1458367247-14607-5-git-send-email-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Hi Andrew,

On 03/19/2016 01:00 AM, Andrew Zaborowski wrote:
> ---
>   ell/gvariant-util.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/ell/gvariant-util.c b/ell/gvariant-util.c
> index 1aaddc3..61e5b52 100644
> --- a/ell/gvariant-util.c
> +++ b/ell/gvariant-util.c
> @@ -497,6 +497,7 @@ static const void *next_item(struct l_dbus_message_iter *iter,
>   	bool last_member;
>   	unsigned int sig_len;
>   	unsigned int offset_len;
> +	unsigned int len = iter->len;

Looks like this belongs in the if block below.

>
>   	memcpy(sig, iter->sig_start + iter->sig_pos,
>   			iter->sig_len - iter->sig_pos);
> @@ -529,7 +530,14 @@ static const void *next_item(struct l_dbus_message_iter *iter,
>   	}
>
>   	if (iter->container_type != DBUS_CONTAINER_TYPE_ARRAY && last_member) {
> -		*out_item_size = iter->len - iter->pos;
> +		offset_len = offset_length(iter->len, 0);
> +		len = iter->len;
> +
> +		if (iter->offsets && iter->offsets + offset_len <
> +				iter->data + len)
> +			len = iter->offsets + offset_len - iter->data;
> +
> +		*out_item_size = len - iter->pos;

This looks fine to me.  I'm guessing the location of the child 
iterator's offsets was being messed up?  Hence variable length field 
sizes were incorrect.  Right?

>   		goto done;
>   	}
>
>

Regards,
-Denis

  reply	other threads:[~2016-03-21 17:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-19  6:00 [PATCH] dbus: More complete buffer size check in dbus_message_from_blob Andrew Zaborowski
2016-03-19  6:00 ` [PATCH] dbus: Replace copy_params/size_params with macros Andrew Zaborowski
2016-03-21 16:42   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH] unit: Add int64_t casts in dbus tests failing on i386 Andrew Zaborowski
2016-03-21 16:44   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH] dbus: Take iter->sig_len into account in l_dbus_message_iter_get_variant Andrew Zaborowski
2016-03-21 16:59   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH] gvariant: Exclude container's offsets from child iterator len Andrew Zaborowski
2016-03-21 17:57   ` Denis Kenzior [this message]
2016-03-21 22:09     ` Andrzej Zaborowski
2016-03-19  6:00 ` [PATCH] gvariant: Reset container's variable_is_last for fixed-size structs Andrew Zaborowski
2016-03-21 18:05   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH] dbus: Fix returned body_size in _dbus1_builder_finish Andrew Zaborowski
2016-03-21 17:02   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH 1/2] dbus: Add _gvariant_builder_mark and _rewind Andrew Zaborowski
2016-03-21 18:05   ` Denis Kenzior
2016-03-19  6:00 ` [PATCH 2/2] unit: reuse mark+rewind, complex 1 tests for gvariant-message Andrew Zaborowski
2016-03-21 18:06   ` Denis Kenzior
2016-03-21 17:16 ` [PATCH] dbus: More complete buffer size check in dbus_message_from_blob Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2016-03-21 22:18 [PATCH] gvariant: Exclude container's offsets from child iterator len Andrew Zaborowski
2016-03-22 15:26 ` Denis Kenzior

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=56F035FD.2050301@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ell@lists.01.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.