All of
 help / color / mirror / Atom feed
From: Rabin Vincent <>
To: James Hogan <>
Subject: Re: [PATCH] MIPS: cevt-r4k: fix array out-of-bounds access
Date: Wed, 5 Apr 2017 15:08:45 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Apr 04, 2017 at 09:32:19PM +0100, James Hogan wrote:
> I think the correct fix is to prevent the read rather than change the
> size of the array. buf2[] is intentionally 3 so that out of 5 sorted
> samples the last element is the median, whereas buf1 is 4 elements so as
> to work out the 75th percentile.
> When inserting the 5th sample into buf1 (i.e. j = 4), there are already
> 4 entries, so the highest element it needs to compare against is the 4th
> one (buf1[k=3]), so thats fine.
> For buf2 however its still trying to insert 5 elements, so by the 5th
> one (i.e. i = 4) it may try to compare against the 4th element to know
> whether to insert before it, at which point we simply don't care about
> the ordering as its past the median.
> So I think something like this would be more correct. Does that fix your
> problem?

Yes, this fixes it too.  Please feel free to submit it yourself with
your explanation.  You can add my Tested-by if you like.


      reply	other threads:[~2017-04-05 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04  7:42 Rabin Vincent
2017-04-04 20:32 ` James Hogan
2017-04-04 20:32   ` James Hogan
2017-04-05 13:08   ` Rabin Vincent [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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \
    --subject='Re: [PATCH] MIPS: cevt-r4k: fix array out-of-bounds access' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.