Re: HashDoS
| From: | Jakub Zelenka | Date: | Thu, 22 Sep 2016 07:52:08 +0000 |
| Subject: | Re: HashDoS | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96092@lists.php.net to get a copy of this message | ||
On 22 Sep 2016 00:43, "Stanislav Malyshev" <smalyshev@gmail.com> wrote:
>
> Hi!
>
> > As linked in my first reply, there was a previous discussion on the
> > topic: http://markmail.org/message/ttbgcvdu4f7uymfb
> > The collision-counting approach that Yasuo references is linked at the
> > start of the first mail:
> > https://github.com/php/php-src/pull/1565
> >
> > Collisions are counted during insertion operations. While we perform a
> > hashtable insertion, we first need to iterate over the existing buckets
> > for a certain hash to see if the insert is actually an update. The
> > implementation simply keeps track of how many buckets we inspect while
> > doing that. If the number is above a certain threshold, an error is
> > generated.
>
> So, count is per-lookup, then I think it's fine then. Sorry for
> misunderstanding it initially. Anything prevents us from merging it? If
> not, let's do it.
>
I don't like the initial version of the patch that was causing fatal error
for json_decode. That's not how json_decode should work. I think that Bob
came up later with a better version that was using json recursion error. It
might require a bit more work for 7.1 as I changed a json parser since then.
Cheers
Jakub