Remi Collet
b1c5532ad1
fix mbfl function prototypes
...
re-add mbfl_convert_filter_feed API
re-add pointer cast
2020-09-15 15:15:06 +02:00
Alex Dowad
a81061d36c
Use symbolic constants in Japanese kana conversion code (not magic numbers)
...
Also correct misspelling of 'hiragana' as 'hirangana' at the same time.
2020-09-03 15:56:29 +02:00
Alex Dowad
ec609916dc
Remove unused 'from' field from mbfl_buffer_converter struct
2020-09-03 15:56:29 +02:00
Alex Dowad
f699d65391
Add comment to mbfilter_tl_jisx0201_jisx0208.h
...
Explain the 'ZEN' and 'HAN' in symbolic constant names.
2020-09-03 15:56:29 +02:00
Alex Dowad
a2b40ee9a5
Remove unneeded function mbfl_filt_ident_common_dtor
...
This was the default destructor for mbfl_identify_filter structs, but there's nothing
we actually need to do to those structs before freeing them.
2020-09-03 15:56:29 +02:00
Alex Dowad
dcd6c6043e
Remove unneeded function mbfl_filt_conv_common_dtor
...
This is a default destructor for mbfl_convert_filter structs. The thing is: there
isn't really anything that needs to be done to those structs before freeing them.
The default destructor just zeroed out some fields, but there's no reason why
we should actually do that.
2020-09-03 15:56:29 +02:00
Alex Dowad
409aa20ab0
Refactor mbfl_convert.c
2020-09-03 15:56:29 +02:00
Alex Dowad
cdc664049c
Comment constants in mbfl_consts.h, remove unused ones
...
These were unused, and almost certainly will never be used:
- MBFL_ENCTYPE_MWC4BE
- MBFL_ENCTYPE_MWC4LE
- MBFL_ENCTYPE_SHFTCODE
- MBFL_ENCTYPE_ENC_STRM
For the latter two, there were some encodings which were marked with these flags;
but nothing ever _checked_ these particular flags.
2020-08-31 23:18:56 +02:00
Alex Dowad
3a100cd7ac
Add comment on mbstring East Asian Width table
2020-08-31 23:18:45 +02:00
Alex Dowad
62317d592f
Remove redundant includes from mbstring (and make sure correct config.h is used)
...
Very interesting... it turns out that when Valgrind support was enabled,
`#include "config.h"` from within mbstring was actually including the file "config.h"
from Valgrind, and not the one from mbstring!!
This is because -I/usr/include/valgrind was added to the compiler invocation _before_
-Iext/mbstring/libmbfl.
Make sure we actually include the file which was intended.
2020-08-31 23:17:58 +02:00
Alex Dowad
b7808d02e8
Remove useless definition of NULL in mbfl_string.h
...
If NULL is not defined by the platform, mbfl_defs.h already defines it.
2020-08-31 23:17:49 +02:00
Alex Dowad
a64241b540
Remove unused functions from mbstring
...
- mbfl_buffer_converter_reset
- mbfl_buffer_converter_strncat
- mbfl_buffer_converter_getbuffer
- mbfl_oddlen
- mbfl_filter_output_pipe_flush
- mbfl_memory_device_output2
- mbfl_memory_device_output4
- mbfl_is_support_encoding
- mbfl_buffer_converter_feed2
- _php_mb_regex_globals_dtor
- mime_header_encoder_feed
- mime_header_decoder_feed
- mbfl_convert_filter_feed
2020-08-31 23:16:57 +02:00
Alex Dowad
d4ef7ef11d
Inline unneeded indirection for mbstring memory management
...
All memory allocation and deallocation for mbstring bounces through a table of
function pointers before going to emalloc/efree/etc. But this is unnecessary.
The allocators are never swapped out. Better to just call them directly.
2020-08-31 23:16:09 +02:00
Nikita Popov
0e71446e7a
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix bug #79787
2020-07-08 11:22:47 +02:00
Nikita Popov
77a8a709da
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix bug #79787
2020-07-08 11:22:18 +02:00
XXiang
3d5de7d746
Fix bug #79787
...
Closes GH-5807.
2020-07-08 11:20:58 +02:00
Christoph M. Becker
3516a9c8f0
Replace ISO_8859-* with ISO8859-* aliases for MBString
...
We also remove the mbregex ISO 8859 aliases with underscores.
2020-06-30 18:43:40 +02:00
Nikita Popov
217f6013b3
Remove no_language from mbfl_string
...
This is not actually used for anything and just causes confusion.
2020-05-07 11:36:57 +02:00
Nikita Popov
226d9dd30a
Only allow "pass" as input/output encoding
...
"pass" is not a real encoding, it just means "don't perform any
conversion". Using it as an internal encoding or passing it to
any of the mbstring() function will not work (and on master commonly
assert).
2020-05-07 11:19:14 +02:00
Nikita Popov
901417f0ae
Fix mbfl default allocators
...
Forgot to remove the persistent allocators from here.
2020-05-04 23:41:39 +02:00
Nikita Popov
a0cae937c5
Spec mbfl allocators as infallible
...
And remove all NULL checks.
2020-05-04 23:19:07 +02:00
Nikita Popov
7d4ff8443e
Remove persistent allocators from libmbfl
...
These functions are not used, and I don't think we have any plans
to ever use them.
2020-05-04 23:19:07 +02:00
Christoph M. Becker
17d4e66204
Fix #68690 : Hypothetical off-by-one condition
...
We fix this, even though `filter->cache == jisx0213_u2_tbl_len` can
never be true here.
2020-04-03 14:20:37 +02:00
George Peter Banyard
363d87f256
Fix [-Wmissing-field-initializers] compiler warning in mbstring
...
Add missing NULL pointer for mbfl_convert_vtbl struct.
2020-02-21 13:19:09 +01:00
Nikita Popov
7d170eb295
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix shift ub in mbstring
Restore digit check in mb_decode_numericentity()
2020-01-30 10:08:21 +01:00
Nikita Popov
43465768f1
Fix shift ub in mbstring
...
Ideally "c" would be an unsigned integer...
2020-01-30 10:07:25 +01:00
Nikita Popov
9aadcb18e1
Restore digit check in mb_decode_numericentity()
...
I replaced it with a multiplication overflow check in
18599f9c52
. However, we need both,
because the code for restoring the number can't handle numbers
with many leading zeros right now and I don't feel like teaching it.
2020-01-30 10:07:01 +01:00
Nikita Popov
b2c8abe951
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Better overflow check for entity decoding
2020-01-29 16:08:55 +01:00
Nikita Popov
18599f9c52
Better overflow check for entity decoding
...
Check for multiplication overflow rather than number of digits.
2020-01-29 16:08:46 +01:00
Nikita Popov
bc32cce6a2
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix recovery of large entities in mb_decode_numericentity()
2020-01-29 11:49:27 +01:00
Nikita Popov
91f878779c
Fix recovery of large entities in mb_decode_numericentity()
...
Make sure we don't overflow the integer.
2020-01-29 11:48:34 +01:00
Nikita Popov
c2d0a413cc
Also use zend_memnrstr in mbfl_strpos
2020-01-24 11:42:54 +01:00
Nikita Popov
d504ad5717
Base mbfl_strpos on zend_memnstr
...
The same algorithm is also used by zend_memnstr, but it also has
a fast-path for short strings / needles, where a more naive
search performs better.
2020-01-24 11:29:34 +01:00
Nikita Popov
73b31302ed
Extract calculation of offset from pointer
2020-01-24 11:15:58 +01:00
Nikita Popov
ce6169832f
Move offset error checking into mbfl_strpos
...
This avoids calculating the full length only in order to validate
the offset, as mbfl_strpos needs to find the offset internally
anyway.
2020-01-24 10:50:02 +01:00
Nikita Popov
0f6d223ddb
Add #defines for mbfl_strpos error conditions
2020-01-24 10:02:41 +01:00
Stanislav Malyshev
545f77d313
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Update NEWS
Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
Fix #79099 : OOB read in php_strip_tags_ex
Fix #79091 : heap use-after-free in session_create_id()
2020-01-20 22:47:28 -08:00
Stanislav Malyshev
a29c793381
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Update NEWS
Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
Fix #79099 : OOB read in php_strip_tags_ex
Fix #79091 : heap use-after-free in session_create_id()
2020-01-20 22:47:01 -08:00
Stanislav Malyshev
25ec7eb346
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Update NEWS
Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
Fix #79099 : OOB read in php_strip_tags_ex
Fix #79091 : heap use-after-free in session_create_id()
2020-01-20 22:46:29 -08:00
Stanislav Malyshev
2bcbc95f03
Fix bug #79037 (global buffer-overflow in mbfl_filt_conv_big5_wchar
)
2020-01-20 21:43:42 -08:00
Máté Kocsis
afdaa91170
Fix #78880 : Final spelling fixes
2020-01-16 19:14:31 +01:00
George Peter Banyard
483efc7e50
Allow empty needles in mb_strpos and mb_strstr function family.
...
MBstring analogous implementation to 6d578482a9
Closes GH-4977
2020-01-07 22:53:35 +01:00
George Peter Banyard
0a173abc84
Revert "Remove dead code in libmbfl, memory device"
...
Stop trusting CLion's automatic dead code detection because it seems to be wrong
more often than not.
This reverts commit 612c86db3e
.
2019-12-13 18:43:14 +01:00
George Peter Banyard
612c86db3e
Remove dead code in libmbfl, memory device
2019-12-13 17:58:37 +01:00
Christoph M. Becker
1d69bf187f
Fix compiler warning
...
This cast is already done for all other _aliases, but this one has
apparently been missed so far.
2019-12-06 16:50:28 +01:00
Nikita Popov
7b152990b6
Don't short-circuit MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE
...
Make sure we always go through mbfl_filt_conv_illegal_output(), so
that the number of illegal characters gets counted.
2019-08-09 16:33:21 +02:00
Nikita Popov
ae2bc6297e
Fix shift UB in mbfilter_utf32.c
2019-06-19 15:09:00 +02:00
Peter Kokot
f7cdac6c97
Remove unused symbol definition
2019-05-11 19:47:54 +02:00
Peter Kokot
9219e56063
Remove redundant memory.h file
...
The memory.h file is part of the pre-C89 era and is on today's systems
only a simple wrapper for including the final string.h header file.
2019-05-11 19:47:54 +02:00
Peter Kokot
3a4df95793
Simplify ext/mbstring/libmbfl/config.h creation
...
- The config.h.in is part of the standalone libmbfl library and it is
forked and bundled.
2019-05-11 19:44:40 +02:00