<div dir="ltr"><div dir="ltr">Hi all,<br><br>Could somebody push this small patch to mesa?<br><br>Regards,<br>Andrii.<div><div class="gmail_quote"><div dir="ltr">On Mon, Aug 20, 2018 at 9:13 PM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 20/08/2018 17:20, <a href="mailto:asimiklit.work@gmail.com" target="_blank">asimiklit.work@gmail.com</a> wrote:<br>
> From: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
><br>
> The "gen_group_get_length" function can return a negative value<br>
> and it can lead to the out of bounds group_iter.<br>
><br>
> v2: printing of "unknown command type" was added<br>
> v3: just the asserts are added<br>
><br>
> Signed-off-by: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
<br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>><br>
<br>
Somebody should take a look at the other patches I sent out ;)<br>
Thanks!<br>
<br>
-<br>
Lionel<br>
> ---<br>
> src/intel/common/gen_decoder.c | 5 ++++-<br>
> 1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c<br>
> index ec0a486..2d9609a 100644<br>
> --- a/src/intel/common/gen_decoder.c<br>
> +++ b/src/intel/common/gen_decoder.c<br>
> @@ -803,8 +803,10 @@ static bool<br>
> iter_more_groups(const struct gen_field_iterator *iter)<br>
> {<br>
> if (iter->group->variable) {<br>
> + int length = gen_group_get_length(iter->group, iter->p);<br>
> + assert(length >= 0 && "error the length is unknown!");<br>
> return iter_group_offset_bits(iter, iter->group_iter + 1) <<br>
> - (gen_group_get_length(iter->group, iter->p) * 32);<br>
> + (length * 32);<br>
> } else {<br>
> return (iter->group_iter + 1) < iter->group->group_count ||<br>
> iter->group->next != NULL;<br>
> @@ -991,6 +993,7 @@ gen_field_iterator_init(struct gen_field_iterator *iter,<br>
> iter->p_bit = p_bit;<br>
> <br>
> int length = gen_group_get_length(iter->group, iter->p);<br>
> + assert(length >= 0 && "error the length is unknown!");<br>
> iter->p_end = length > 0 ? &p[length] : NULL;<br>
> iter->print_colors = print_colors;<br>
> }<br>
<br>
<br>
</blockquote></div></div></div></div>