> On 14 May 2015, at 9:27 pm, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
> 
> Hi Arvids,
> 
> On Mon, May 11, 2015 at 8:01 PM, Arvids Godjuks <arvids.godj...@gmail.com>
> wrote:
> 
>> Hello, I have read through your blog post, and I agreed on the issue
>> earlier, nut I have a question that bugs me for a while: what DoS issue are
>> you talking about? I tried to imagine any scenario that can lead to a DoS
>> wuith a type hint and can't think of any happening...
> 
> 
> Too large value raise typeException (Thanks Nikita)
> DoS is easy on 32 bit CPU machines, but it's possible on 64 bit machines
> also.
> 
> Simplest scenario would be client side DoS. Many IoT devices will remain 32
> bits and if it
> gets result value larger than 2 billions, execution may stopped by
> unhandled exception
> sudduly. Library/framework uses basic type hint may harm system like this.
> 
> Some databases support unsigned INT8. Most databases support NUMERIC/DECIMAL
> which can have value larger signed 64 bit int. If attacker find way to
> store too large ID
> somewhere (e.g. as JSON/XML text that queries database), then system may
> use the
> value against type hinted functions/methods.
> 
> Without basic type hints, these concerns weren't existed.
> 
> Regards,
> 
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net


Yasuo,

I still don’t see how you can put the blame for the unhanded exception on type 
hints. The problem you’re describing is not new and exists today with libraries 
using code like this:

function foo($int) {
    if(!is_int($int)) {
        throw new InvalidArgumentException(‘Parameter must be of type int’);
    }
    //… do something with $int
}

Cheers,
David


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to