Skip to content

Commit 1979c5d

Browse files
committed
Upgrade to Oniguruma 6.9.4
Oniguruma 6.9.4 fixes several CVEs.
1 parent 8c4b0dd commit 1979c5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3749
-2981
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
- GD:
1212
. Fixed bug #78849 (GD build broken with -D SIGNED_COMPARE_SLOW). (cmb)
1313

14+
- MBString:
15+
. Upgraded bundled Oniguruma to 6.9.4. (cmb)
16+
1417
- OPcache:
1518
. Fixed potential ASLR related invalid opline handler issues. (cmb)
1619
. Fixed $x = (bool)$x; with opcache (should emit undeclared variable notice).

ext/mbstring/oniguruma/HISTORY

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
History
22

3+
2019/11/29: Version 6.9.4
4+
5+
2019/11/22: Release Candidate 3 for Version 6.9.4
6+
7+
2019/11/20: fix a problem found by libFuzzer test
8+
2019/11/14: Release Candidate 2 for Version 6.9.4
9+
2019/11/12: fix integer overflow by nested quantifier
10+
2019/11/11: fix CVE-2019-19012: Integer overflow related to reg->dmax in search_in_range()
11+
2019/11/07: fix CVE-2019-19203: heap-buffer-overflow in gb18030_mbc_enc_len()
12+
2019/11/06: fix CVE-2019-19204: heap-buffer-overflow in fetch_interval_quantifier()
13+
2019/11/06: add HAVE_INTTYPES_H into config.h.windows.in and config.h.win{32,64}
14+
2019/11/06: add HAVE_STDINT_H into config.h.win{32,64}
15+
2019/11/05: Release Candidate 1 for Version 6.9.4
16+
2019/10/31: Update Unicode Emoji version to 12.1 (Nothing data changed)
17+
2019/10/29: implement USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR configuration
18+
2019/10/18: re-implement case fold conversion
19+
2019/10/04: fix #156: Heap buffer overflow in match_at() with case-insensitive match
20+
2019/09/30: NEW API: add onig_regset_replace()
21+
2019/09/30: change Unicode VERSION value format
22+
2019/09/20: NEW API: add regset functions
23+
2019/09/20: add data ensure check before peek string value in OP_PUSH_IF_PEEK_NEXT
24+
2019/09/20: fix loose code in encode-harness.c
25+
2019/08/13: fix heap-buffer-overflow
26+
2019/08/13: Add a macro to disable direct threading in the match engine (PR#149)
27+
328
2019/08/06: Version 6.9.3 (secirity fix release)
429

5-
2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE
30+
2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC
631
2019/07/29: add STK_PREC_READ_START/END stack type
732
2019/07/29: Fix #147: Stack Exhaustion Problem caused by some parsing functions
833
2019/07/11: add a dictionary file for libfuzzer

ext/mbstring/oniguruma/README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,34 @@ Supported character encodings:
2727
* doc/SYNTAX.md: contributed by seanofw
2828

2929

30+
Version 6.9.4
31+
-------------
32+
33+
* NEW API: RegSet (set of regexes)
34+
* Fixed CVE-2019-19012
35+
* Fixed CVE-2019-19203 (Does not affect UTF-8, UTF-16 and UTF-32 encodings)
36+
* Fixed CVE-2019-19204 (Affects only PosixBasic, Emacs and Grep syntaxes)
37+
* Fixed CVE-2019-19246
38+
* Fixed some problems (found by libFuzzer test)
39+
40+
3041
Version 6.9.3 (security fix release)
3142
------------------------------------
3243

3344
* Fixed CVE-2019-13224
3445
* Fixed CVE-2019-13225
35-
* Fixed many problems (found by libfuzzer programs)
46+
* Fixed CVE-2019-16163
47+
* Fixed many problems (found by libFuzzer test)
3648

3749

3850
Version 6.9.2 (Reiwa)
3951
---------------------
4052

4153
* add doc/SYNTAX.md
54+
* Direct threaded code (for GCC and Clang)
4255
* Update Unicode version 12.1.0
4356
* NEW: Unicode Text Segment mode option (?y{g}) (?y{w}) (*original)
4457

45-
g: Extended Grapheme Cluster mode / w: Word mode
46-
47-
(Unicode Standard Annex #29 [http://unicode.org/reports/tr29/])
48-
4958

5059
Version 6.9.1
5160
-------------
@@ -118,7 +127,7 @@ Version 6.5.0
118127
* NEW: \O (true anychar)
119128
* NEW: if-then-else (?(...)...\|...)
120129
* NEW: Backreference validity checker (?(xxx)) (*original)
121-
* NEW: Absent repeater (?~absent) \[is equal to (?\~\|absent|\O*)]
130+
* NEW: Absent repeater (?~absent) \[is equal to (?\~\|(?:absent)|\O*)]
122131
* NEW: Absent expression (?~|absent|expr) (*original)
123132
* NEW: Absent stopper (?~|absent) (*original)
124133

@@ -244,15 +253,18 @@ Sample Programs
244253

245254
|File |Description |
246255
|:---------------------|:-----------------------------------------|
256+
|sample/callout.c |example of callouts |
257+
|sample/count.c |example of built-in callout *COUNT |
258+
|sample/echo.c |example of user defined callouts of name |
259+
|sample/encode.c |example of some encodings |
260+
|sample/listcap.c |example of the capture history |
261+
|sample/names.c |example of the named group callback |
262+
|sample/posix.c |POSIX API sample |
263+
|sample/regset.c |example of using RegSet API |
264+
|sample/scan.c |example of using onig_scan() |
247265
|sample/simple.c |example of the minimum (Oniguruma API) |
248-
|sample/names.c |example of the named group callback. |
249-
|sample/encode.c |example of some encodings. |
250-
|sample/listcap.c |example of the capture history. |
251-
|sample/posix.c |POSIX API sample. |
252-
|sample/scan.c |example of using onig_scan(). |
253-
|sample/sql.c |example of the variable meta characters. |
254-
|sample/user_property.c|example of user defined Unicode property. |
255-
|sample/callout.c |example of callouts. |
266+
|sample/sql.c |example of the variable meta characters |
267+
|sample/user_property.c|example of user defined Unicode property |
256268

257269

258270
Test Programs

ext/mbstring/oniguruma/doc/API

Lines changed: 135 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Oniguruma API Version 6.9.3 2019/07/06
1+
Oniguruma API Version 6.9.4 2019/09/30
22

33
#include <oniguruma.h>
44

@@ -168,7 +168,7 @@ Oniguruma API Version 6.9.3 2019/07/06
168168
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
169169
OnigCompileInfo* ci, OnigErrorInfo* einfo)
170170

171-
This function is deprecate, and it does not allow the case where
171+
This function is deprecated, and it does not allow the case where
172172
the encoding of pattern and target is different.
173173

174174
Create a regex object.
@@ -306,6 +306,7 @@ Oniguruma API Version 6.9.3 2019/07/06
306306

307307
normal return: match position offset (i.e. p - str >= 0)
308308
not found: ONIG_MISMATCH (< 0)
309+
error: error code (< 0)
309310

310311
arguments
311312
1 reg: regex object
@@ -342,7 +343,8 @@ Oniguruma API Version 6.9.3 2019/07/06
342343
Do not pass invalid byte string in the regex character encoding.
343344

344345
normal return: match length (>= 0)
345-
not match: ONIG_MISMATCH ( < 0)
346+
not match: ONIG_MISMATCH (< 0)
347+
error: error code (< 0)
346348

347349
arguments
348350
1 reg: regex object
@@ -391,6 +393,136 @@ Oniguruma API Version 6.9.3 2019/07/06
391393
7 callback_arg: optional argument passed to callback
392394

393395

396+
# int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
397+
398+
Create a regset object.
399+
All regex objects must have the same character encoding.
400+
All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option.
401+
402+
arguments
403+
1 rset: return address of regset object
404+
2 n: number of regex in regs
405+
3 regs: array of regex
406+
407+
normal return: ONIG_NORMAL
408+
409+
410+
# int onig_regset_add(OnigRegSet* set, regex_t* reg)
411+
412+
Add a regex into regset.
413+
The regex object must have the same character encoding with the regset.
414+
The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option.
415+
416+
arguments
417+
1 set: regset object
418+
2 reg: regex object
419+
420+
normal return: ONIG_NORMAL
421+
422+
423+
# int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
424+
425+
Replace a regex in regset with another one.
426+
If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed)
427+
428+
arguments
429+
1 set: regset object
430+
2 at: index of regex (zero origin)
431+
3 reg: regex object
432+
433+
normal return: ONIG_NORMAL
434+
435+
436+
# void onig_regset_free(OnigRegSet* set)
437+
438+
Free memory used by regset object and regex objects in the regset.
439+
If the same regex object is registered twice, the situation becomes destructive.
440+
441+
arguments
442+
1 set: regset object
443+
444+
445+
# int onig_regset_number_of_regex(OnigRegSet* set)
446+
447+
Returns number of regex objects in the regset.
448+
449+
arguments
450+
1 set: regset object
451+
452+
453+
# regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
454+
455+
Returns the regex object corresponding to the at-th regex.
456+
457+
arguments
458+
1 set: regset object
459+
2 at: index of regex array (zero origin)
460+
461+
462+
# OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
463+
464+
Returns the region object corresponding to the at-th regex.
465+
466+
arguments
467+
1 set: regset object
468+
2 at: index of regex array (zero origin)
469+
470+
471+
# int onig_regset_search(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos)
472+
473+
Perform a search with regset.
474+
475+
return value:
476+
normal return: index of match regex (zero origin)
477+
not found: ONIG_MISMATCH (< 0)
478+
error: error code (< 0)
479+
480+
arguments
481+
1 set: regset object
482+
2 str: target string
483+
3 end: terminate address of target string
484+
4 start: search start address of target string
485+
5 range: search terminate address of target string
486+
6 lead: outer loop element
487+
ONIG_REGSET_POSITION_LEAD (returns most left position)
488+
ONIG_REGSET_REGEX_LEAD (returns most left position)
489+
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
490+
7 option: search time option
491+
ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
492+
ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
493+
8 rmatch_pos: return address of match position (match_address - str)
494+
495+
* ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result.
496+
These differences only appear in search time.
497+
In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster.
498+
499+
500+
# int onig_regset_search_with_param(OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos)
501+
502+
Perform a search with regset and match-params.
503+
504+
return value:
505+
normal return: index of match regex (zero origin)
506+
not found: ONIG_MISMATCH (< 0)
507+
error: error code (< 0)
508+
509+
arguments
510+
1 set: regset object
511+
2 str: target string
512+
3 end: terminate address of target string
513+
4 start: search start address of target string
514+
5 range: search terminate address of target string
515+
6 lead: outer loop element
516+
ONIG_REGSET_POSITION_LEAD (returns most left position)
517+
ONIG_REGSET_REGEX_LEAD (returns most left position)
518+
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
519+
7 option: search time option
520+
ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
521+
ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
522+
8 mps: array of match-params
523+
9 rmatch_pos: return address of match position (match_address - str)
524+
525+
394526
# OnigRegion* onig_region_new(void)
395527

396528
Create a region.

0 commit comments

Comments
 (0)