Commit Graph

1308 Commits

Author SHA1 Message Date
Nikita Popov
6b73b2d6eb Check for empty string in mb_ord() 2017-08-04 22:20:05 +02:00
Nikita Popov
353f7bf461 Also check for invalid codepoints in mb_ord()
And return false in that case, instead of returning 0x3f...
2017-08-04 13:01:03 +02:00
Nikita Popov
e53162a32b Return false on invalid codepoint in mb_chr()
Instead of returning the encoding of the current substitution
character. This allows a robust check for the failure case. The
substitution character (especially the default of "?") is also
a valid output of mb_chr() for a valid input (for "?" that would be
0x3f), so it's a bad choice for an error value.
2017-08-03 22:36:42 +02:00
Nikita Popov
41e9ba6333 Always use Unicode codepoints in mb_ord() and mb_chr()
Previously mb_chr() had two different encoding-dependent behaviors:
 * For "Unicode-encodings" it took a Unicode codepoint and returned
   its encoded representation.
 * Otherwise it returned a big-endian binary encoding of the passed
   integer.

Now the input is always interpreted as a Unicode codepoint. If
a big-endian binary encoding is what you want, you don't need
mbstring to implement that.
2017-08-03 22:14:00 +02:00
Nikita Popov
fb9bf5b64b Revert/fix substitution character fallback
The introduced checks were not correct in two respects:
 * It was checked whether the source encoding of the string matches
   the internal encoding, while the actually relevant encoding is
   the *target* encoding.
 * Even if the correct encoding is used, the checks are still too
   conservative. Just because something is not a "Unicode-encoding"
   does not mean that it does not map any non-ASCII characters.

I've reverted the added checks and instead adjusted mbfl_convert
to first try to use the provided substitution character and if
that fails, perform the fallback to '?' at that point. This means
that any codepoint mapped in the target encoding should now be
correctly supported and anything else should fall back to '?'.
2017-08-03 21:53:59 +02:00
Nikita Popov
a8a9e93e9a Revert/fix mb_substitute_character() codepoint checks
The introduced checks did not treat "non-Unicode" encodings correctly,
because they treated the passed integer as encoded in the internal
encoding in that case, while in actuality the substitute character
is always a Unicode codepoint.

Additionally checking the codepoint against the internal encoding
is not correct in any case, because the substitution character must
be mapped in the *target* encoding of the conversion, which does
not necessarily coincide with the internal encoding (the internal
encoding is the default *source* encoding, not *target* encoding).

This reverts the checks back to simple range checks, but in a way
that still resolves #69079: Characters outside the Basic
Multilingual Plane are now accepted and Surrogate Codepoints are
rejected. A distinction between UTF-8 and non-UTF-8 encodings is
not made for surrogate checks (as in the original patch), as
surrogates are always illegal on their own. Specifying a surrogate
as substitution character would only make sense if you could
specify a substitution string with more than one character --
however we do not support that.
2017-08-03 21:12:41 +02:00
Nikita Popov
91240073ea Merge branch 'PHP-7.1' into PHP-7.2 2017-08-02 18:11:12 +02:00
Nikita Popov
63607375f5 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-02 18:09:09 +02:00
Fabien Villepinte
2cc1cbf2f4 Fix Bug #75001: Wrong reflection on mb_eregi_replace 2017-08-02 18:08:42 +02:00
Nikita Popov
5d777e56e2 Merge branch 'PHP-7.1' into PHP-7.2 2017-07-28 13:03:26 +02:00
Nikita Popov
c48c638aeb Merge branch 'PHP-7.0' into PHP-7.1 2017-07-28 13:03:02 +02:00
Nikita Popov
e3d25e78eb Fixed bug #62934 2017-07-28 13:02:25 +02:00
Nikita Popov
706f0cf8a0 Update Unicode data for Unicode 10 2017-07-23 16:05:39 +02:00
Nikita Popov
24cfbfd56f Update ucgendat for more bidi properties
Handle them the same way as others -- by classifying as Other
Neutral.
2017-07-23 16:03:11 +02:00
Nikita Popov
077e61fad3 Fixed bug #69267 completely
ucgendat.c was assuming that a title-case character is a character
that has both lower and upper-case variants. However, there are
title-case characters that only have a lower-case variant. Use the
Lt general character proprety to determine where in the case map
the character should be placed instead.
2017-07-23 15:30:17 +02:00
Nikita Popov
c0bcd301d3 Another fix for bug #69267
mb_strtoupper() was converting lowercase characters into
titlecase characters, instead of uppercase characters. Luckily
there are only very few characters with a distinct titlecase
representation, so this mostly worked out okay...
2017-07-23 15:07:02 +02:00
Nikita Popov
0e4af9192f Partial fix for bug #69267
This pulls in 60a25c72ba389f53b0621ca250bc99f3b295d43f from the
OpenLDAP project.
2017-07-23 14:47:21 +02:00
Nikita Popov
88f752a947 Merge branch 'PHP-7.1' into PHP-7.2 2017-07-23 12:21:51 +02:00
Nikita Popov
f116a88592 Merge branch 'PHP-7.0' into PHP-7.1 2017-07-23 12:21:16 +02:00
Christoph M. Becker
418da85f15 Fix #71606: Segmentation fault mb_strcut with HTML-ENTITIES
The HTML decoding filter uses the `opaque` member of mbfl_convert_filter
as buffer, but there was no copy constructor defined, what caused double
frees when the filter is copied (what happens multiple times in mb_strcut(),
for instance).
2017-07-23 12:19:27 +02:00
Nikita Popov
9af5b7f33d Fix use after free in mb_send_mail 2017-07-23 11:55:26 +02:00
Anatol Belski
1e2764614b add oniguruma.patch to ease future upgrades 2017-07-13 17:34:14 +02:00
Lior Kaplan
c2c60fcac7 SIZEOF_SIZE_T doesn't exist on AIX and POWER8 (ppc64le), keep using SIZEOF_LONG 2017-07-13 18:05:47 +03:00
Anatol Belski
b8a334f149 reapply platform related onig patches 2017-05-30 15:47:56 +02:00
Remi Collet
bee52f352f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  NEWS
  Patch from the upstream git https://github.com/kkos/oniguruma/issues/60 (CVE-2017-9228)
  Patch from the upstream git https://github.com/kkos/oniguruma/issues/59 (CVE-2017-9229) b690371bbf97794b4a1d3f295d4fb9a8b05d402d Modified for onig 5.9.6
  Patch from the upstream git https://github.com/kkos/oniguruma/issues/58 (CVE-2017-9227)
  Patch from the upstream git https://github.com/kkos/oniguruma/issues/57 (CVE-2017-9224)
  Patch from the upstream git https://github.com/kkos/oniguruma/issues/55 (CVE-2017-9226) b4bf968ad52afe14e60a2dc8a95d3555c543353a Modified for onig 5.9.6 f015fbdd95f76438cd86366467bb2b39870dd7c6 Modified for onig 5.9.6
2017-05-30 15:45:52 +02:00
Remi Collet
1c845d2950 Patch from the upstream git
https://github.com/kkos/oniguruma/issues/60 (CVE-2017-9228)

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
2017-05-30 15:40:32 +02:00
Remi Collet
5416deec66 Patch from the upstream git
https://github.com/kkos/oniguruma/issues/59 (CVE-2017-9229)
b690371bbf97794b4a1d3f295d4fb9a8b05d402d Modified for onig 5.9.6

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
2017-05-30 15:39:21 +02:00
Remi Collet
6a8ae7cf8d Patch from the upstream git
https://github.com/kkos/oniguruma/issues/58 (CVE-2017-9227)

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
2017-05-30 15:38:17 +02:00
Remi Collet
60b1829e1c Patch from the upstream git
https://github.com/kkos/oniguruma/issues/57 (CVE-2017-9224)

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
2017-05-30 15:37:11 +02:00
Remi Collet
1e0c4386ab Patch from the upstream git
https://github.com/kkos/oniguruma/issues/55 (CVE-2017-9226)
b4bf968ad52afe14e60a2dc8a95d3555c543353a Modified for onig 5.9.6
f015fbdd95f76438cd86366467bb2b39870dd7c6 Modified for onig 5.9.6

Thanks to Mamoru TASAKA <mtasaka@fedoraproject.org>
2017-05-30 15:35:42 +02:00
Remi Collet
0ae2f95b8b Update Oniguruma to latest upstream version 6.3.0
Windows specific changes need to be applied again.
2017-05-30 14:14:57 +02:00
Sara Golemon
9d6b7435e4 Ignore ext/mbstring/oniguruma/oniguruma.h
This is just copied in from ext/mbstring/oniguruma/src/oniguruma.h
and is hasn't been kept in GIT since Nov 2016.
2017-05-02 21:48:47 -07:00
Thomas Punt
9f08aff3fd Remove superfluous allocation checks around ZMM-based functions 2017-04-02 00:58:19 +02:00
Thomas Punt
932c4b35dc Remove more unnecessary checks on Zend's allocator functions 2017-03-16 12:23:55 +01:00
Nikita Popov
edcabf6d07 Drop unnecessary allocator return value checks 2017-03-13 22:07:15 +01:00
Anatol Belski
297e435722 remove accidentially commited file 2017-03-07 01:33:19 +01:00
Nikita Popov
a8239ff232 Deprecate mbstring.func_overload 2017-02-03 21:02:52 +01:00
Nikita Popov
2df9346e7f Deprecate mb_parse_str() without second argument 2017-02-03 18:52:57 +01:00
Brian Evans
2fe9208ee3
Use modern autotools name of configure.ac instead of configure.in
configure.ac was introduced in 2001 with automake-1.15 and autoconf-2.50
to replace the file named configure.in.
Autotools is preparing to remove configure.in in Automake 2.0.
All new software should be using configure.ac.
This also fixes Bug #69770 where extensions are creating configure.in

Signed-off-by: Brian Evans <grknight@gentoo.org>
2017-01-27 06:07:40 +00:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Joe Watkins
c8aa6f3a9a
Merge branch 'pull-request/2268'
* pull-request/2268:
  Update copyright headers to 2017
2017-01-04 10:00:53 +00:00
Joe Watkins
f9a435a06d
Merge branch 'pull-request/1094'
* pull-request/1094:
  added php_mb_check_code_point for mb_substitute_character
  news entry for PR #1094
2017-01-04 06:57:34 +00:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski
8b7fe6cb8a Merge branch 'PHP-7.1'
* PHP-7.1:
  fix C89 compat
2016-12-17 20:47:05 +01:00
Anatol Belski
f86e077ec8 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix C89 compat
2016-12-17 20:46:09 +01:00
Anatol Belski
58a945cf68 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix C89 compat
2016-12-17 20:45:22 +01:00
Anatol Belski
79e47aae41 fix C89 compat 2016-12-17 20:43:32 +01:00
Xinchen Hui
bc6b17148b Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73646 (mb_ereg_search_init null pointer dereference)
2016-12-09 15:56:41 +08:00
Xinchen Hui
6a43c61bcd Fixed bug #73646 (mb_ereg_search_init null pointer dereference) 2016-12-09 15:55:07 +08:00