Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-09-06 Thread Andrea Faulds
Hi Sherif, Sherif Ramadan wrote: Of course, but the ASM can also be ported to other architectures and wrapped in #ifdef for non x86 and MSVC or other compilers, for example. It's not impossible to achieve some sane degree of portability there. I see Andrea already worked on some of this in zend

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Pierre Joye
On Aug 25, 2015 7:19 PM, "Matt Wilmas" wrote: > > I didn't reply in last week's thread about the overflow checks in OpenSSL... > > But it is *definitely* fine to be optimistic and rely on compiler to do basic, basic stuff like this. No reason to make things more complicated just to think one is

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Anatol Belski
y, August 25, 2015 9:29 AM > > > To: Anatol Belski > > > Cc: Rowan Collins ; PHP Internals > > > > > > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > > > > > Hi Anatol, > > > > > > I don'

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Anatol Belski
27; > ; 'Jakub Zelenka' > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > But it is *definitely* fine to be optimistic and rely on compiler to do basic, basic > stuff like this. No reason to make things more complic

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Jakub Zelenka
rnals > > > > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > > > Hi Anatol, > > > > I don't see any problem adding ZEND_LONG_INT_OVF and similar macros into > > 7.0. > > > Thanks for taking a look. I was doing a qu

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Matt Wilmas
ssage- From: Matt Wilmas [mailto:php_li...@realplain.com] Sent: Tuesday, August 25, 2015 12:06 PM To: Anatol Belski ; 'Dmitry Stogov' ; 'Xinchen Hui' ; 'Nikita Popov' ; 'Pierre Joye' ; 'Bob Weinand' ; 'Jakub Zelenka' Cc: inter

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Anatol Belski
Hi Dmitry, > -Original Message- > From: Dmitry Stogov [mailto:dmi...@zend.com] > Sent: Tuesday, August 25, 2015 9:29 AM > To: Anatol Belski > Cc: Rowan Collins ; PHP Internals > > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > Hi A

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Anatol Belski
ierre Joye' ; 'Bob Weinand' > ; 'Jakub Zelenka' > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > Hi Anatol, Dmitry, all, > > - Original Message - > From: "Anatol Belski" > Sen

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Matt Wilmas
Hi Anatol, Dmitry, all, - Original Message - From: "Anatol Belski" Sent: Friday, August 21, 2015 Hi, Resending this as missed internals at the start. I was lately rethinking some part of the 64-bit RFC, and also seeing now Jakub's work on catching overflows in ext/openssl and Matt Wil

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-25 Thread Dmitry Stogov
> Sent: Monday, August 24, 2015 12:29 AM > > To: internals@lists.php.net > > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > > > On 22/08/2015 02:38, Sherif Ramadan wrote: > > > I see. So you're not actually doing overflow checks then? Be

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-24 Thread Anatol Belski
Hi Rowan, > -Original Message- > From: Rowan Collins [mailto:rowan.coll...@gmail.com] > Sent: Monday, August 24, 2015 12:29 AM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > On 22/08/2015 02:38, Sherif Ramadan

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-24 Thread Anatol Belski
Hi Sherif, > -Original Message- > From: Sherif Ramadan [mailto:theanomaly...@gmail.com] > Sent: Monday, August 24, 2015 4:06 PM > To: Rowan Collins > Cc: PHP Internals > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > Hey Rowan, > >

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-24 Thread Sherif Ramadan
Hey Rowan, Yup, I get it now. Sorry for the confusion. I actually remember fixing a similar bug in pdo_sqlite a while back where casting/translation between the two sizes caused such an issue. So I think this would be pretty helpful. On Sun, Aug 23, 2015 at 6:28 PM, Rowan Collins wrote: > On 2

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-23 Thread Rowan Collins
On 22/08/2015 02:38, Sherif Ramadan wrote: I see. So you're not actually doing overflow checks then? Because at the point you'd be checking this zend_long or size_t it could have already overflowed or wrapped. The subject may have misled me to understand differently. I think I understand the co

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Sherif Ramadan
> Nikita Popov ; Pierre Joye ; > > Bob Weinand ; Jakub Zelenka ; Matt > > Wilmas ; PHP Internals > > > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > > > I think you're a little optimistic about how effective these macros > wou

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Anatol Belski
als > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > I think you're a little optimistic about how effective these macros would be > for > overflow checks. Also, if we're talking ANSI C or C99, then size_t is always > unsigned, and as far as

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Sherif Ramadan
AM > > To: 'Sherif Ramadan' > > Cc: 'Dmitry Stogov' ; 'Xinchen Hui' >; > > 'Nikita Popov' ; 'Pierre Joye' < > pierre@gmail.com>; > > 'Bob Weinand' ; 'Jakub Zelenka' ; > > 'Matt W

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Anatol Belski
> 'Bob Weinand' ; 'Jakub Zelenka' ; > 'Matt Wilmas' ; 'PHP Internals' > > Subject: RE: [PHP-DEV] Overflow checks and integral vars comparison > > Hi Sherif, > > > -Original Message- > > From: Sherif Ramadan [mailto:thea

RE: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Anatol Belski
PHP Internals > Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison > > Maybe I'm missing something here, but how do these macros detect overflow > exactly? If the check is done on the actual result and not the operands then > it's > not a good overfl

Re: [PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Sherif Ramadan
Maybe I'm missing something here, but how do these macros detect overflow exactly? If the check is done on the actual result and not the operands then it's not a good overflow check. Additionally, why wouldn't overflow checks be needed on 32-bit architecture, or any other architecture for that matt

[PHP-DEV] Overflow checks and integral vars comparison

2015-08-21 Thread Anatol Belski
Hi, Resending this as missed internals at the start. I was lately rethinking some part of the 64-bit RFC, and also seeing now Jakub's work on catching overflows in ext/openssl and Matt Williams suggestions on it (which was going a bit more global over it). So I came up with these macros with two