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

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

2015-08-25 Thread Dmitry Stogov
, 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? Because at the point you'd be checking this zend_long or size_t

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

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

2015-08-25 Thread Anatol Belski
@gmail.com; 'Pierre Joye' pierre@gmail.com; 'Bob Weinand' bobw...@hotmail.com; 'Jakub Zelenka' bu...@php.net Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison Hi Anatol, Dmitry, all, - Original Message - From: Anatol Belski Sent: Friday

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 anatol@belski.net Cc: Rowan Collins rowan.coll...@gmail.com; PHP Internals internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks

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

2015-08-25 Thread Anatol Belski
internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison Hi Anatol, On Tue, Aug 25, 2015 at 12:41 PM, Anatol Belski anatol@belski.net wrote: Hi Dmitry, -Original Message- From: Dmitry Stogov [mailto:dmi...@zend.com] Sent: Tuesday

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

2015-08-25 Thread Matt Wilmas
; 'Jakub Zelenka' bu...@php.net Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison Hi Anatol, Dmitry, all, - Original Message - From: Anatol Belski Sent: Friday, August 21, 2015 Hi, Resending this as missed internals at the start. I

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

2015-08-25 Thread Jakub Zelenka
...@gmail.com; PHP Internals internals@lists.php.net 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 quick RFC draft yesterday also

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

2015-08-25 Thread Anatol Belski
@gmail.com; 'Bob Weinand' bobw...@hotmail.com; 'Jakub Zelenka' bu...@php.net 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

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

2015-08-25 Thread Pierre Joye
On Aug 25, 2015 7:19 PM, Matt Wilmas php_li...@realplain.com 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

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

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 wrote: I see. So you're

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 rowan.coll...@gmail.com Cc: PHP Internals internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison Hey

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

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

2015-08-21 Thread Sherif Ramadan
xinche...@zend.com; Nikita Popov nikita@gmail.com; Pierre Joye pierre@gmail.com; Bob Weinand bobw...@hotmail.com; Jakub Zelenka bu...@php.net; Matt Wilmas php_li...@realplain.com; PHP Internals internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison

[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

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

2015-08-21 Thread Anatol Belski
@gmail.com; Bob Weinand bobw...@hotmail.com; Jakub Zelenka bu...@php.net; Matt Wilmas php_li...@realplain.com; PHP Internals internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison I think you're a little optimistic about how effective these macros would

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

2015-08-21 Thread Anatol Belski
@gmail.com; Bob Weinand bobw...@hotmail.com; Jakub Zelenka bu...@php.net; Matt Wilmas php_li...@realplain.com; PHP Internals internals@lists.php.net Subject: Re: [PHP-DEV] Overflow checks and integral vars comparison Maybe I'm missing something here, but how do these macros detect overflow

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

2015-08-21 Thread Anatol Belski
@gmail.com; 'Bob Weinand' bobw...@hotmail.com; 'Jakub Zelenka' bu...@php.net; 'Matt Wilmas' php_li...@realplain.com; 'PHP Internals' internals@lists.php.net Subject: RE: [PHP-DEV] Overflow checks and integral vars comparison Hi Sherif, -Original Message- From: Sherif Ramadan

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

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

2015-08-21 Thread Sherif Ramadan
: [PHP-DEV] Overflow checks and integral vars comparison Hi Sherif, -Original Message- From: Sherif Ramadan [mailto:theanomaly...@gmail.com] Sent: Friday, August 21, 2015 11:21 AM To: Anatol Belski anatol@belski.net Cc: Dmitry Stogov dmi...@php.net; Xinchen Hui