1
0
mirror of https://github.com/php/php-src.git synced 2026-04-04 06:32:49 +02:00
Nikita Popov 5b3f4d25ea Fix memory allocation checks for base64 encode
base64_encode used safe_emalloc, but one of the arguments was derived from a
multiplication, thus making the allocation unsafe again.

There was a size check in place, but it was off by a factor of two as it
didn't account for the signedness of the integer type.

The unsafe allocation is not exploitable, but still causes funny behavior
when the sized overflows into a negative number.

To fix the issue the *4 factor is moved into the size argument (where it is
known to be safe), so safe_emalloc can carry out the multiplication.

The size check is removed as it doesn't really make sense once safe_emalloc
works correctly. (Would only cause base64_encode to silently return false
instead of throwing an error. Also could cause problems with other uses of
the base64 encoding API, which all don't check for a NULL return value.)

Furthermore the (length + 2) < 0 check is replaced with just length < 0.
Allowing lengths -2 and -1 doesn't make sense semantically and also is not
honored in the following code (negative length would access unallocated
memory.)

Actually the length < 0 check doesn't make sense altogether, but I left it
there just to be safe.
2012-06-24 23:32:50 +02:00
2012-06-08 01:21:37 -07:00
2009-08-02 19:11:15 +00:00
2012-06-07 14:31:35 +08:00
2012-03-22 17:22:17 +08:00
2012-06-10 18:17:37 +04:00
2009-07-20 10:51:40 +00:00
2012-05-16 16:49:35 +02:00
2011-12-04 16:46:45 +00:00
2003-02-20 00:19:04 +00:00
2012-01-01 13:15:04 +00:00
2011-04-27 09:29:10 +00:00
2010-10-05 22:58:19 +00:00
2009-11-23 21:53:30 +00:00
2008-03-19 23:24:56 +00:00
2004-02-08 22:49:47 +00:00
2012-06-23 15:21:20 -03:00
2008-06-19 17:59:35 +00:00
MFH
2008-01-17 14:38:16 +00:00
2009-06-04 18:20:45 +00:00
2012-02-03 08:14:39 +00:00
2005-09-19 19:03:53 +00:00
2009-07-13 16:10:29 +00:00
2007-05-01 23:04:30 +00:00
2005-11-13 18:02:47 +00:00
2010-09-10 14:01:44 +00:00

The Win32 Build System.

See http://wiki.php.net/internals/windows/stepbystepbuild 

vim:tw=78:sw=1:ts=1:et

Description
⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-01-22T16:25:23.756Z
Readme 928 MiB
Languages
C 66%
PHP 31.3%
C++ 0.8%
Shell 0.5%
M4 0.4%
Other 0.8%