Compare commits

...
Author SHA1 Message Date
Christoph M. Becker 793d775b04 Bump version 2020-01-07 10:15:39 +01:00
Christoph M. Becker 06e78cad83 Revert "Extend CURLFile to support streams"
This reverts commit 17a9f1401a, because
this commit would break ABI, and also due to bug #79013.
We keep the commit for PHP 7.4+, though.
2020-01-06 15:31:49 +01:00
Christoph M. Becker ae2150692a Fix #54298: Using empty additional_headers adding extraneous CRLF
If the header string is empty, we pass `NULL` to `php_mail()` to avoid
further checks on the string length.
2020-01-06 14:47:23 +01:00
Christoph M. Becker 4bec59f175 Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<https://github.com/libgd/libgd/commit/9088591eae437358ee5b929adf82865e37e3001e>.
2020-01-06 10:36:48 +01:00
Christoph M. Becker 2c5860517c Fix #79067: gdTransformAffineCopy() may use unitialized values
We port
<https://github.com/libgd/libgd/commit/7a06c1669c563917bc48c464521e3de962ddb4e8>.
2020-01-06 09:35:13 +01:00
Christoph M. Becker c05a069adf Fix #78808: [LMDB] MDB_MAP_FULL: Environment mapsize limit reached
We implement support for a fifth parameter, which allows to specify the
mapsize.  The parameter defaults to zero, in which case the compiled in
default mapsize (usually 1048576) will be used.  The mapsize should be
a multiple of the page size of the OS.
2020-01-03 18:49:12 +01:00
Christoph M. Becker 18172303f4 Fix #78538: shmop memory leak
If the descriptor's refcount drops to zero, we have to unmap the
respective file view, to avoid leaking memory.
2020-01-03 18:10:29 +01:00
Christoph M. Becker b48f2625b5 Fix #79015: undefined-behavior in php_date.c
We check that the given microsecond fraction is in the valid range
[0, 1000000[, and otherwise mark it as invalid.  We also drop the
useless do loop; a plain block is sufficient here.
2020-01-03 14:31:03 +01:00
Christoph M. Becker 0cecf83b26 Fix #79040: Warning Opcode handlers are unusable due to ASLR
We must not use the same shared memory OPcache instance for different
SAPIs, since their memory layout is different.  To avoid this, we add
the SAPI name (truncated to at most 20 characters) to the names of the
memory base file, the mutex and the file mapping.
2019-12-30 15:12:58 +01:00
Christoph M. Becker 1aa419dcdc Add missing skipif clause 2019-12-28 11:00:37 +01:00
Christoph M. Becker c47b18a222 Fix #79033: Curl timeout error with specific url and post
We must not set an empty mime structure as `CURLOPT_MIMEPOST`; instead
we set it to `NULL` if `CURLOPT_POSTFIELDS` has been set to an empty
array.
2019-12-28 10:47:03 +01:00
Xinchen Hui 27bb3289ac Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
We backport the fix PHP 7.3, since this branch is affected as well.

(cherry picked from commit b5e0043796)
(cherry picked from commit e36daa6927)
(cherry picked from commit 2704ee6844)
2019-12-25 12:33:30 +01:00
SATO Kentaro 37d11d123e Fix #78982: pdo_pgsql returns dead persistent connection
Call PQconsumeInput() before PQstatus() to update the status.
2019-12-20 12:05:17 +01:00
SATO Kentaro 7e39e6934d Fix #78980: pgsqlGetNotify() overlooks dead connection
pgsqlGetNotify() didn't check result of PQconsumeInput().
2019-12-20 11:44:07 +01:00
Sergei Turchanov c62cd9a43a Fix #74170: locale information change after mime_content_type
Some functions in libmagic (distributed with fileinfo extension) perform this sequence of calls:
func() {
setlocale(LC_TYPE, "C")
.. do some work ..
setlocale(LC_TYPE, "")
}

It effectively resets LC_TYPE if it that was set before the function call.

To avoid manipulations with current locale at all, the problematic functions
were modified to use locale-independent functions.
2019-12-20 11:22:59 +01:00
SATO Kentaro cbb0efaeeb Fix #78402: pcntl_signal() misleading error message
An error message can be misleading when a handler
passed to pcntl_signal() is not callable.
2019-12-20 11:02:20 +01:00
Dmitry Stogov eb846939b1 Fixed bug #78999 (Cycle leak when using function result as temporary) 2019-12-19 23:11:08 +03:00
SATO Kentaro 3e35b08980 Fix #78983: pdo_pgsql config.w32 cannot find libpq-fe.h
When configured with a path specified.
2019-12-19 13:20:43 +01:00
Nikita Popov 0f078f6e78 Add destructor annotations in ini parser
It would be better to switch this to use %union and %type annotations,
but not going to do that change for 7.3.
2019-12-19 10:43:05 +01:00
Remi Collet bacfae8baf fix release date 2019-12-18 14:17:31 +01:00
Remi Collet 22dec2b323 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  fix release date
2019-12-18 14:17:21 +01:00
Remi Collet 864f5ef12f fix release date 2019-12-18 14:16:19 +01:00
Nikita Popov 897d99c7a4 Rethrow generator exception even without active stack frame
Finally blocks in generators may be invoked during shutdown, in
which case we don't have a stack frame. Similar to what
zend_call_function does, we still need to rethrow these exceptions,
otherwise they will be hidden (and leak).
2019-12-18 11:04:15 +01:00
Nikita Popov 189f625e2b Fix freeing of dynamic call name
We need to free op2 if the call construction fails.

Also remove a redundant check for !call.
2019-12-18 10:11:09 +01:00
Christoph M. Becker 3d50131ef7 Update/fix NEWS [ci skip] 2019-12-17 10:04:42 +01:00
Christoph M. Becker b94c28b0e6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] Update  NEWS
2019-12-17 10:01:50 +01:00
Stanislav Malyshev 0e413241ec [ci skip] Update NEWS 2019-12-16 23:45:11 -08:00
Stanislav Malyshev 9705e631a4 [ci skip] Update NEWS 2019-12-16 23:41:04 -08:00
Stanislav Malyshev a62154564d Fix test 2019-12-16 10:32:49 -08:00
Stanislav Malyshev 5cb4686753 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test
  Fix bug #78793
2019-12-16 10:04:03 -08:00
Stanislav Malyshev 6d5cddabaf Fix test 2019-12-16 10:03:43 -08:00
Stanislav Malyshev c14eb8de97 Fix bug #78793 2019-12-16 01:14:58 -08:00
Stanislav Malyshev b74a300edf Fix build - no model field anymore 2019-12-16 01:10:42 -08:00
Stanislav Malyshev a65b8abf2c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
2019-12-16 00:38:54 -08:00
Stanislav Malyshev d348cfb96f Fixed bug #78910 2019-12-16 00:10:39 -08:00
Christoph M. Becker eb23c60087 Fix #78878: Buffer underflow in bc_shift_addsub
We must not rely on `isdigit()` to detect digits, since we only support
decimal ASCII digits in the following processing.
2019-12-16 00:05:03 -08:00
Stanislav Malyshev b771a18133 Fix test 2019-12-16 00:03:18 -08:00
Christoph M. Becker 0e6c0654ed Fix #78862: link() silently truncates after a null byte on Windows
Since link() is supposed to accepts paths (i.e. strings without NUL
bytes), we must not accept arbitrary strings.
2019-12-16 00:03:06 -08:00
Christoph M. Becker a5a15965da Fix #78863: DirectoryIterator class silently truncates after a null byte
Since the constructor of DirectoryIterator and friends is supposed to
accepts paths (i.e. strings without NUL bytes), we must not accept
arbitrary strings.
2019-12-16 00:02:57 -08:00
Christoph M. Becker 518a160b65 Fix #78943: mail() may release string with refcount==1 twice
Since we need `headers_lc` as well as `headers_trim` in the following,
we do not release the former even if they are the same string, to avoid
complicating the release logic even more.

A new test case is not necessary, since we already have
mail_basic_alt2-win32.phpt and others.
2019-12-15 13:13:30 -08:00
Nikita Popov 621598eaa8 Fixed bug #78921
By resetting fake_scope during autoloading. We already do the same
when executing destructors.
2019-12-13 16:37:20 +01:00
Nikita Popov 87691e74e5 Fix DCE with FE_FETCH
For now, don't treat FE_FETCH op2 as no-val use. See GH-4982.
2019-12-10 09:00:09 +01:00
Christoph M. Becker 17a9f1401a Extend CURLFile to support streams
Due to former restrictions of the libcurl API, curl multipart/formdata
file uploads supported only proper files.  However, as of curl 7.56.0
the new `curl_mime_*()` API is available (and already supported by
PHP[1]), which allows us to support arbitrary *seekable* streams, which
is generally desirable, and particularly resolves issues with the
transparent Unicode and long part support on Windows (see bug #77711).

Note that older curl versions are still supported, but CURLFile is
still restricted to proper files in this case.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=a83b68ba56714bfa06737a61af795460caa4a105>

(cherry picked from commit c68dc6b5e3)
2019-12-09 10:30:00 +01:00
Christoph M. Becker e1202733a5 Use curl_mime_*() functions if available
As of curl 7.56.0, `curl_formadd()` is deprecated in favor of
`curl_mime_*()`, so we use the latter if available.

(cherry picked from commit a83b68ba56)
2019-12-09 10:24:49 +01:00
willson-chen b5d2cbe027 Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it.

Fix ported from <https://github.com/libgd/libgd/pull/559>.
2019-12-07 12:06:33 +01:00
Nikita Popov 249e49092d Fix constant evaluation of && and ||
The "return" in the for loop should have been a break on the switch,
otherwise the result is just ignored... but because it prevents
evaluation of the other operand, it also violates the invariant that
everything has been constant evaluated, resulting in an assertion
failure.

The for loop isn't correct in any case though, because it's not legal
to determine the result based on just the second operand, as the
first one may have a side-effect that cannot be optimized away.
2019-12-06 11:07:57 +01:00
Nikita Popov fac43d6515 Fix AST printing of nullable builtin types
Fixes oss-fuzz #19109.
2019-12-04 11:20:52 +01:00
Tyson Andre c8e9aa854c Fix print_r return types in opcache
https://www.php.net/print_r

> When the return parameter is TRUE, this function will return a string.
> Otherwise, the return value is TRUE.
2019-12-04 07:16:32 +01:00
Christoph M. Becker 65bbc67063 Next is 7.3.14 2019-12-03 12:04:17 +01:00
Remi Collet 3444b90746 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  next is 7.2.27
2019-12-03 11:26:05 +01:00
Remi Collet d2cfb63f02 next is 7.2.27 2019-12-03 11:25:37 +01:00
Christoph M. Becker 861fa60814 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:38:45 +01:00
Christoph M. Becker 600f1f898f Fix #78814: strip_tags allows / in tag name => whitelist bypass
When normalizing tags to check whether they are contained in the set
of allowable tags, we must not strip slashes, unless they come
immediately after the opening `<`, or immediately before the closing
`>`.
2019-12-02 11:37:25 +01:00
Christoph M. Becker bb735c9e9e Fix #78296: is_file fails to detect file
If we're constructing extended-length paths (i.e. paths prefixed with
`\\?\`), we have to replace all forward slashes with backward slashes,
because the former are not supported by Windows for extended-length
paths.

The more efficient and likely cleaner alternative solution would be to
cater to this in `php_win32_ioutil_normalize_path_w()` by always
replacing forward slashes, but that might break existing code.  It
might be sensible to change that for `master`, though.
2019-12-02 11:29:10 +01:00
Christoph M. Becker 3d81c54879 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78833: Integer overflow in pack causes out-of-bound access
2019-12-02 11:19:15 +01:00
Christoph M. Becker db420cb6a1 Fix #78833: Integer overflow in pack causes out-of-bound access
We check for potential signed integer overflow, and bail out
gracefully, in that case.
2019-12-02 11:18:19 +01:00
Christoph M. Becker 1979c5d16f Upgrade to Oniguruma 6.9.4
Oniguruma 6.9.4 fixes several CVEs.
2019-11-30 14:00:41 +01:00
Christoph M. Becker 8c4b0ddde5 Add missing skip checks 2019-11-29 23:50:05 +01:00
Christoph M. Becker ff2140c49d Partially revert "Adapt test cases for Oniguruma 6.9.4"
This partially reverts commit c55d09c2f5,
because `MB_ONIGURUMA_VERSION` is only available as of PHP 7.4.0, so
that change made no sense for PHP-7.3; we keep it for PHP-7.4, though.
We also stick with the modification to bug78633.phpt.
2019-11-29 23:40:30 +01:00
Christoph M. Becker c55d09c2f5 Adapt test cases for Oniguruma 6.9.4
Apparently, bug 78633 has now really been fixed; the former fix only
catered to the buffer overflow, but yielded a wrong result.  Also,
the order of the named captures has been fixed.
2019-11-29 16:59:19 +01:00
Christoph M. Becker fee38633d2 Fix #78840: imploding $GLOBALS crashes
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01:00
Christoph M. Becker 23c65a8173 Fix #77638: var_export'ing certain class instances segfaults
If objects return immutable property hash tables (typically,
`zend_empty_array`), we must not try to apply recursion protection on
those.
2019-11-25 15:54:11 +01:00
Dmitry Stogov bb30fe9e2b Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) 2019-11-25 14:05:43 +03:00
Christoph M. Becker e1da72bdf1 Fix #78853: preg_match() may return integer > 1
Commit 54ebebd[1] optimized the match loop, but for this case it has
been overlooked, that we must only loop if we're doing global matching.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=54ebebd686255c5f124af718c966edb392782d4a>
2019-11-22 19:26:26 +01:00
George Wang e981f5af51 Merge branch 'PHP-7.2' into PHP-7.3 2019-11-21 17:58:16 -05:00
George Wang c7141412ce Added environment LSAPI_CLEAN_SHUTDOWN to control clean shutdown. Update SAPI version to LiteSpeed v7.6 . 2019-11-21 17:57:50 -05:00
Christoph M. Becker b4f501d5a4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:01:05 +01:00
Christoph M. Becker 9b92c1d154 Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
Apparently, this has not been tested for a long time, and might be a
refactoring relict.  Anyhow, we have to pass the context to
`GIFNextPixel` as well.
2019-11-21 09:59:26 +01:00
Christoph M. Becker 3b46fbfc36 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
2019-11-18 12:47:53 +01:00
Christoph M. Becker f6eac76b65 Update NEWS 2019-11-18 12:46:43 +01:00
Dmitry Stogov e72e3370c6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:26:30 +03:00
Tyson Andre a2c41c0ea6 Fix $x = (bool)$x; for undefined with opcache
And `$x = !$x`

Noticed while working on GH-4912

The included test would not emit undefined variable errors in php 8.0
with opcache enabled. The command used:

```
php -d zend_extension=opcache.so --no-php-ini -d error_reporting=E_ALL \
    -d opcache.file_cache= -d opcache.enable_cli=1  test.php
```
2019-11-18 11:24:03 +03:00
Christoph M. Becker 39d04f15f8 Fix ASLR related invalid opline handler issues
Opcache stores `opline->handler`s in shared memory.  These pointers are
invalid, if the main PHP DLL is loaded at another base address due to
ASLR.  We therefore store the address of `execute_ex` in the mmap base
file, and check on startup whether it matches its current address.  If
not, we fall back on the file cache if enabled, and bail out otherwise.

This still does not address cases where the opline handler is located
inside of another DLL (e.g. for some profilers, debuggers), but there
seems to be no general solution for now.

(cherry picked from commit 8ba10b8fbc)
2019-11-15 09:46:58 +01:00
Dmitry Stogov 9083e178f6 Fixed wrong constant usage 2019-11-12 12:59:50 +03:00
Stanislav Malyshev ea2a125789 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78804 - Segmentation fault in Locale::filterMatches
2019-11-11 23:08:38 -08:00
Stanislav Malyshev 2c9926f156 Fix bug #78804 - Segmentation fault in Locale::filterMatches 2019-11-11 22:32:35 -08:00
Levi Morrison 4a55794b98 Wrap php_random.h in C++ portability macros
Also remove portability headers. This goes against the existing
conventions of these files.
2019-11-08 07:58:26 -07:00
Levi Morrison b9dfa12853 Wrap hrtime in extern "c" {}
This allows it to be used by C++ extensions without them having to do their own forward declares.

Closes GH-4890.
2019-11-07 14:41:58 +01:00
Nikita Popov 6dcc0b859f Fix php_pcre_mutex_free()
We should only set the mutex to NULL if we actually freed it.
Due to missing braces non-main threads may currently set it to
NULL first.
2019-11-07 14:31:19 +01:00
Nikita Popov 29f4939923 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Remove outdated comments in test
2019-11-07 14:06:33 +01:00
Nikita Popov ee243bc471 Remove outdated comments in test 2019-11-07 14:06:23 +01:00
Nikita Popov 8d2a9d8859 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78759
2019-11-07 11:16:24 +01:00
Nikita Popov 5fa6dcd972 Fixed bug #78759
Handle INDIRECT values in array.
2019-11-07 11:15:29 +01:00
Nikita Popov 6d4965febd Fixed bug #78787
Not the first time inheritance of shadow properties causes an issue,
thankfully this whole concept is gone in PHP 7.4.
2019-11-06 12:52:34 +01:00
Christoph M. Becker 4c9ba3e042 7.3.13 is next 2019-11-05 18:20:56 +01:00
165 changed files with 4874 additions and 3124 deletions

No files matched your search

+103 -1
View File
@@ -1,6 +1,108 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.12
?? ??? ????, PHP 7.3.14
23 Jan 2020, PHP 7.3.14
- Core
. Fixed bug #78999 (Cycle leak when using function result as temporary).
(Dmitry)
- CURL:
. Fixed bug #79033 (Curl timeout error with specific url and post). (cmb)
- Date:
. Fixed bug #79015 (undefined-behavior in php_date.c). (cmb)
- DBA:
. Fixed bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached).
(cmb)
- Fileinfo:
. Fixed bug #74170 (locale information change after mime_content_type).
(Sergei Turchanov)
- GD:
. Fixed bug #78923 (Artifacts when convoluting image with transparency).
(wilson chen)
. Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
. Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
(cmb)
- Libxml:
. Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)
- OPcache:
. Fixed bug #79040 (Warning Opcode handlers are unusable due to ASLR). (cmb)
- Pcntl:
. Fixed bug #78402 (Converting null to string in error message is bad DX).
(SATŌ Kentarō)
- PDO_PgSQL:
. Fixed bug #78983 (pdo_pgsql config.w32 cannot find libpq-fe.h). (SATŌ
Kentarō)
. Fixed bug #78980 (pgsqlGetNotify() overlooks dead connection). (SATŌ
Kentarō)
. Fixed bug #78982 (pdo_pgsql returns dead persistent connection). (SATŌ
Kentarō)
- Shmop:
. Fixed bug #78538 (shmop memory leak). (cmb)
- Standard:
. Fixed bug #54298 (Using empty additional_headers adding extraneous CRLF).
(cmb)
18 Dec 2019, PHP 7.3.13
- Bcmath:
. Fixed bug #78878 (Buffer underflow in bc_shift_addsub). (CVE-2019-11046).
(cmb)
- Core:
. Fixed bug #78862 (link() silently truncates after a null byte on Windows).
(CVE-2019-11044). (cmb)
. Fixed bug #78863 (DirectoryIterator class silently truncates after a null
byte). (CVE-2019-11045). (cmb)
. Fixed bug #78943 (mail() may release string with refcount==1 twice).
(CVE-2019-11049). (cmb)
. Fixed bug #78787 (Segfault with trait overriding inherited private shadow
property). (Nikita)
. Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value).
(Antony Dovgal, Dmitry)
. Fixed bug #78296 (is_file fails to detect file). (cmb)
- EXIF:
. Fixed bug #78793 (Use-after-free in exif parsing under memory sanitizer).
(CVE-2019-11050). (Nikita)
. Fixed bug #78910 (Heap-buffer-overflow READ in exif). (CVE-2019-11047).
(Nikita)
- GD:
. Fixed bug #78849 (GD build broken with -D SIGNED_COMPARE_SLOW). (cmb)
- MBString:
. Upgraded bundled Oniguruma to 6.9.4. (cmb)
- OPcache:
. Fixed potential ASLR related invalid opline handler issues. (cmb)
. Fixed $x = (bool)$x; with opcache (should emit undeclared variable notice).
(Tyson Andre)
- PCRE:
. Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
- Standard:
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
. Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb)
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
. Fixed bug #78833 (Integer overflow in pack causes out-of-bound access).
(cmb)
. Fixed bug #78814 (strip_tags allows / in tag name => whitelist bypass).
(cmb)
21 Nov 2019, PHP 7.3.12
- Core:
. Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
+7 -1
View File
@@ -721,6 +721,7 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
TSRM_API int shmdt(const void *shmaddr)
{/*{{{*/
shm_pair *shm = shm_get(0, (void*)shmaddr);
int ret;
if (!shm->segment) {
return -1;
@@ -730,7 +731,12 @@ TSRM_API int shmdt(const void *shmaddr)
shm->descriptor->shm_lpid = getpid();
shm->descriptor->shm_nattch--;
return UnmapViewOfFile(shm->addr) ? 0 : -1;
ret = UnmapViewOfFile(shm->addr) ? 0 : -1;
if (!ret && shm->descriptor->shm_nattch <= 0) {
ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1;
shm->descriptor = NULL;
}
return ret;
}/*}}}*/
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf)
+6
View File
@@ -490,6 +490,12 @@ JSON:
Curl:
. libcurl >= 7.15.5 is now required.
DBA:
. As of PHP 7.3.14, dba_open() accepts a fifth optional parameter for lmdb
databases which allows to specify the mapsize. The parameter defaults to
zero, in which case the compiled in default mapsize (usually 1048576) will
be used. The mapsize should be a multiple of the page size of the OS.
Filter:
. FILTER_VALIDATE_FLOAT now also supports a `thousand` option, which
defines the set of allowed thousand separator chars. The default (`"',."`)
+2 -2
View File
@@ -94,7 +94,7 @@ L0:
}
}));
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
class A {
use T1, T2 {
T1::foo insteadof foo;
@@ -244,7 +244,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c,
})) failed in %sexpect_015.php on line %d
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
class A {
use T1, T2 {
T1::foo insteadof foo;
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #78787: Segfault with trait overriding inherited private shadow property
--FILE--
<?php
trait T {
private $prop;
}
class C1 {
/** Doc comment */
private $prop;
}
class C2 extends C1 {
}
class C3 extends C2 {
use T;
}
?>
===DONE===
--EXPECT--
===DONE===
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value
--FILE--
<?php
class C {
private $private = 1;
function foo() {
$this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
}
}
class A {
static $foo = B::foo; //not resolved on include()
}
function main_autoload($class_name) {
$c = new C;
$c->foo();
//doesn't affect the error
eval("class B {const foo = 1;}");
}
spl_autoload_register('main_autoload', false);
$classA = new ReflectionClass("A");
$props = $classA->getProperties();
$props[0]->setValue(2); //causes constant resolving, which runs autoload, all with EG(fake_scope) == "A"
echo "OK\n";
?>
--EXPECT--
OK
+36
View File
@@ -0,0 +1,36 @@
--TEST--
Bug #78921: When Reflection triggers class load, property visibility is incorrect
--FILE--
<?php
spl_autoload_register(function($className) {
if ($className == 'PrivateStatic') {
class PrivateStatic
{
const SOME_CONST = 13;
private static $privateStaticVarArray = ['a', 'b', 'c'];
private static $otherStatic;
public static function init()
{
self::$otherStatic = self::$privateStaticVarArray;
}
}
PrivateStatic::init();
}
});
class OtherClass
{
const MY_CONST = PrivateStatic::SOME_CONST;
public static $prop = 'my property';
}
$reflectionClass = new ReflectionClass('OtherClass');
$reflectionProperty = $reflectionClass->getProperty('prop');
$reflectionProperty->setAccessible(true);
$value = $reflectionProperty->getValue();
echo "Value is $value\n";
?>
--EXPECT--
Value is my property
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #78999 (Cycle leak when using function result as temporary)
--FILE--
<?php
function get() {
$t = new stdClass;
$t->prop = $t;
return $t;
}
var_dump(get());
var_dump(gc_collect_cycles());
--EXPECT--
object(stdClass)#1 (1) {
["prop"]=>
*RECURSION*
}
int(1)
+9
View File
@@ -0,0 +1,9 @@
--TEST--
Incorrect constant evaluation of and/or (OSS-Fuzz #19255)
--FILE--
<?php
const C = 0 && __namespace__;
var_dump(C);
?>
--EXPECT--
bool(false)
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Freeing of function "name" when dynamic call fails
--FILE--
<?php
try {
$bar = "bar";
("foo" . $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$bar = ["bar"];
(["foo"] + $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
(new stdClass)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Call to undefined function foobar()
Function name must be a string
Function name must be a string
@@ -0,0 +1,30 @@
--TEST--
Generator exceptions during shutdown should not be swallowed
--FILE--
<?php
function gen() {
try {
echo "before yield\n";
yield;
echo "after yield\n";
} finally {
echo "before yield in finally\n";
yield;
echo "after yield in finally\n";
}
echo "after finally\n";
}
$gen = gen();
$gen->rewind();
?>
--EXPECTF--
before yield
before yield in finally
Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.3.12-dev"
#define ZEND_VERSION "3.3.14RC1"
#define ZEND_ENGINE_3
+6
View File
@@ -4082,6 +4082,12 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string
zval *property;
zend_class_entry *old_scope = EG(fake_scope);
if (UNEXPECTED(!(scope->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
if (UNEXPECTED(zend_update_class_constants(scope)) != SUCCESS) {
return FAILURE;
}
}
EG(fake_scope) = scope;
property = zend_std_get_static_property(scope, name, 0);
EG(fake_scope) = old_scope;
+1 -1
View File
@@ -1463,7 +1463,7 @@ simple_list:
}
break;
case ZEND_AST_TYPE:
switch (ast->attr) {
switch (ast->attr & ~ZEND_TYPE_NULLABLE) {
case IS_ARRAY: APPEND_STR("array");
case IS_CALLABLE: APPEND_STR("callable");
EMPTY_SWITCH_DEFAULT_CASE();
+17 -14
View File
@@ -8549,25 +8549,28 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
case ZEND_AST_AND:
case ZEND_AST_OR:
{
int i;
for (i = 0; i <= 1; i++) {
zend_eval_const_expr(&ast->child[i]);
if (ast->child[i]->kind == ZEND_AST_ZVAL) {
if (zend_is_true(zend_ast_get_zval(ast->child[i])) == (ast->kind == ZEND_AST_OR)) {
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
return;
}
}
}
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
zend_bool child0_is_true, child1_is_true;
zend_eval_const_expr(&ast->child[0]);
zend_eval_const_expr(&ast->child[1]);
if (ast->child[0]->kind != ZEND_AST_ZVAL) {
return;
}
child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0]));
if (child0_is_true == (ast->kind == ZEND_AST_OR)) {
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
break;
}
if (ast->child[1]->kind != ZEND_AST_ZVAL) {
return;
}
child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1]));
if (ast->kind == ZEND_AST_OR) {
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) || zend_is_true(zend_ast_get_zval(ast->child[1])));
ZVAL_BOOL(&result, child0_is_true || child1_is_true);
} else {
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) && zend_is_true(zend_ast_get_zval(ast->child[1])));
ZVAL_BOOL(&result, child0_is_true && child1_is_true);
}
break;
}
+4
View File
@@ -836,6 +836,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
zend_string *lc_name;
zend_fcall_info fcall_info;
zend_fcall_info_cache fcall_cache;
zend_class_entry *orig_fake_scope;
if (key) {
lc_name = Z_STR_P(key);
@@ -922,11 +923,14 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
fcall_cache.called_scope = NULL;
fcall_cache.object = NULL;
orig_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
zend_exception_save();
if ((zend_call_function(&fcall_info, &fcall_cache) == SUCCESS) && !EG(exception)) {
ce = zend_hash_find_ptr(EG(class_table), lc_name);
}
zend_exception_restore();
EG(fake_scope) = orig_fake_scope;
zval_ptr_dtor(&args[0]);
zval_ptr_dtor_str(&fcall_info.function_name);
+4 -3
View File
@@ -827,9 +827,10 @@ try_again:
if (UNEXPECTED(EG(exception) != NULL)) {
if (generator == orig_generator) {
zend_generator_close(generator, 0);
if (EG(current_execute_data) &&
EG(current_execute_data)->func &&
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
if (!EG(current_execute_data)) {
zend_throw_exception_internal(NULL);
} else if (EG(current_execute_data)->func &&
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
zend_rethrow_exception(EG(current_execute_data));
}
} else {
+8 -4
View File
@@ -1595,10 +1595,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
/* next: check for conflicts with current class */
if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
zend_string_release_ex(coliding_prop->name, 0);
if (coliding_prop->doc_comment) {
zend_string_release_ex(coliding_prop->doc_comment, 0);
}
/* Only free if shadow is coming from direct parent,
* otherwise these weren't copied in the first place. */
if (coliding_prop->ce == ce->parent) {
zend_string_release_ex(coliding_prop->name, 0);
if (coliding_prop->doc_comment) {
zend_string_release_ex(coliding_prop->doc_comment, 0);
}
}
zend_hash_del(&ce->properties_info, prop_name);
flags |= ZEND_ACC_CHANGED;
} else {
+1 -1
View File
@@ -310,7 +310,7 @@ static void zval_ini_dtor(zval *zv)
%left '|' '&' '^'
%right '~' '!'
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL cfg_var_ref constant_literal constant_string encapsed_list expr option_offset section_string_or_value string_or_value var_string_list var_string_list_section
%%
+11 -5
View File
@@ -741,8 +741,10 @@ ZEND_VM_COLD_CONST_HANDLER(13, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_TRUE(EX_VAR(opline->result.var));
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -3342,11 +3344,11 @@ ZEND_VM_C_LABEL(try_function_name):
call = NULL;
}
FREE_OP2();
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
FREE_OP2();
if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -3358,8 +3360,6 @@ ZEND_VM_C_LABEL(try_function_name):
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -3860,6 +3860,10 @@ ZEND_VM_HOT_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -4846,8 +4850,10 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_FALSE(EX_VAR(opline->result.var));
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+51 -13
View File
@@ -2137,8 +2137,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -2313,11 +2311,11 @@ try_function_name:
call = NULL;
}
zval_ptr_dtor_nogc(free_op2);
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
zval_ptr_dtor_nogc(free_op2);
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -2329,8 +2327,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -2446,8 +2442,6 @@ try_function_name:
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -2485,8 +2479,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CON
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_TRUE(EX_VAR(opline->result.var));
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (IS_CONST == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -2731,6 +2727,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -3056,8 +3056,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_H
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_FALSE(EX_VAR(opline->result.var));
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (IS_CONST == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -12101,8 +12103,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_TRUE(EX_VAR(opline->result.var));
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -12363,8 +12367,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_FALSE(EX_VAR(opline->result.var));
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -17663,6 +17669,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -20431,6 +20441,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -36411,8 +36425,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_TRUE(EX_VAR(opline->result.var));
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (IS_CV == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -36871,6 +36887,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -37234,8 +37254,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCO
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_FALSE(EX_VAR(opline->result.var));
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (IS_CV == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
GET_OP1_UNDEF_CV(val, BP_VAR_R);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -55708,6 +55730,10 @@ zend_leave_helper_SPEC_LABEL:
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -57322,6 +57348,10 @@ zend_leave_helper_SPEC_LABEL:
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -57608,6 +57638,10 @@ zend_leave_helper_SPEC_LABEL:
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
@@ -59250,6 +59284,10 @@ zend_leave_helper_SPEC_LABEL:
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
} else {
Z_ADDREF_P(return_value);
+2 -2
View File
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=3
PHP_RELEASE_VERSION=12
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=14
PHP_EXTRA_VERSION="RC1"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+2 -2
View File
@@ -57,9 +57,9 @@ bc_str2num (bc_num *num, char *str, int scale)
zero_int = FALSE;
if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */
while (*ptr == '0') ptr++; /* Skip leading zeros. */
while (isdigit((int)*ptr)) ptr++, digits++; /* digits */
while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */
if (*ptr == '.') ptr++; /* decimal point */
while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */
if ((*ptr != '\0') || (digits+strscale == 0))
{
*num = bc_copy_num (BCG(_zero_));
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #78878 (Buffer underflow in bc_shift_addsub)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
?>
--FILE--
<?php
print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4));
?>
--EXPECT--
0
+52 -1
View File
@@ -1844,7 +1844,11 @@ static void curl_free_string(void **string)
*/
static void curl_free_post(void **post)
{
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
curl_mime_free((curl_mime *)*post);
#else
curl_formfree((struct HttpPost *)*post);
#endif
}
/* }}} */
@@ -2764,16 +2768,30 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
HashTable *postfields;
zend_string *string_key;
zend_ulong num_key;
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
curl_mime *mime = NULL;
curl_mimepart *part;
CURLcode form_error;
#else
struct HttpPost *first = NULL;
struct HttpPost *last = NULL;
CURLFORMcode form_error;
#endif
postfields = HASH_OF(zvalue);
if (!postfields) {
php_error_docref(NULL, E_WARNING, "Couldn't get HashTable in CURLOPT_POSTFIELDS");
return FAILURE;
}
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
if (zend_hash_num_elements(postfields) > 0) {
mime = curl_mime_init(ch->cp);
if (mime == NULL) {
return FAILURE;
}
}
#endif
ZEND_HASH_FOREACH_KEY_VAL(postfields, num_key, string_key, current) {
zend_string *postval, *tmp_postval;
/* Pretend we have a string_key here */
@@ -2808,6 +2826,20 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
if (Z_TYPE_P(prop) == IS_STRING && Z_STRLEN_P(prop) > 0) {
filename = Z_STRVAL_P(prop);
}
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
part = curl_mime_addpart(mime);
if (part == NULL) {
zend_string_release_ex(string_key, 0);
return FAILURE;
}
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|| (form_error = curl_mime_filedata(part, ZSTR_VAL(postval))) != CURLE_OK
|| (form_error = curl_mime_filename(part, filename ? filename : ZSTR_VAL(postval))) != CURLE_OK
|| (form_error = curl_mime_type(part, type ? type : "application/octet-stream")) != CURLE_OK) {
error = form_error;
}
#else
form_error = curl_formadd(&first, &last,
CURLFORM_COPYNAME, ZSTR_VAL(string_key),
CURLFORM_NAMELENGTH, ZSTR_LEN(string_key),
@@ -2819,6 +2851,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
/* Not nice to convert between enums but we only have place for one error type */
error = (CURLcode)form_error;
}
#endif
}
zend_string_release_ex(string_key, 0);
@@ -2827,6 +2860,18 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
postval = zval_get_tmp_string(current, &tmp_postval);
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
part = curl_mime_addpart(mime);
if (part == NULL) {
zend_tmp_string_release(tmp_postval);
zend_string_release_ex(string_key, 0);
return FAILURE;
}
if ((form_error = curl_mime_name(part, ZSTR_VAL(string_key))) != CURLE_OK
|| (form_error = curl_mime_data(part, ZSTR_VAL(postval), ZSTR_LEN(postval))) != CURLE_OK) {
error = form_error;
}
#else
/* The arguments after _NAMELENGTH and _CONTENTSLENGTH
* must be explicitly cast to long in curl_formadd
* use since curl needs a long not an int. */
@@ -2841,6 +2886,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
/* Not nice to convert between enums but we only have place for one error type */
error = (CURLcode)form_error;
}
#endif
zend_tmp_string_release(tmp_postval);
zend_string_release_ex(string_key, 0);
} ZEND_HASH_FOREACH_END();
@@ -2853,8 +2899,13 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
if ((*ch->clone) == 1) {
zend_llist_clean(&ch->to_free->post);
}
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
zend_llist_add_element(&ch->to_free->post, &mime);
error = curl_easy_setopt(ch->cp, CURLOPT_MIMEPOST, mime);
#else
zend_llist_add_element(&ch->to_free->post, &first);
error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first);
#endif
} else {
#if LIBCURL_VERSION_NUM >= 0x071101
zend_string *tmp_str;
+1
View File
@@ -3,6 +3,7 @@ Bug #78775: TLS issues from HTTP request affecting other encrypted connections
--SKIPIF--
<?php
if (!extension_loaded('curl')) die('skip Requires curl');
if (!extension_loaded('openssl')) die('skip Requires openssl');
if (getenv('SKIP_ONLINE_TESTS')) die('skip Online test');
?>
--FILE--
+29
View File
@@ -0,0 +1,29 @@
--TEST--
Bug #79033 (Curl timeout error with specific url and post)
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "{$host}/get.inc?test=post",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [],
CURLINFO_HEADER_OUT => true,
CURLOPT_RETURNTRANSFER => true,
]);
var_dump(curl_exec($ch));
var_dump(curl_getinfo($ch)["request_header"]);
?>
--EXPECTF--
string(%d) "array(0) {
}
"
string(90) "POST /get.inc?test=post HTTP/1.1
Host: localhost:%d
Accept: */*
Content-Length: 0
"
+7 -5
View File
@@ -4389,14 +4389,16 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
do {
{
zval *z_arg = zend_hash_str_find(myht, "f", sizeof("f") - 1);
(*intobj)->diff->us = -1000000;
if (z_arg) {
(*intobj)->diff->us = ((double)zval_get_double(z_arg) * 1000000);
} else {
(*intobj)->diff->us = (double) -1000000;
double val = zval_get_double(z_arg) * 1000000;
if (val >= 0 && val < 1000000) {
(*intobj)->diff->us = val;
}
}
} while (0);
}
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
+42
View File
@@ -0,0 +1,42 @@
--TEST--
Bug #79015 (undefined-behavior in php_date.c)
--FILE--
<?php
$payload = 'O:12:"DateInterval":16:{s:1:"y";i:1;s:1:"m";i:0;s:1:"d";i:4;s:1:"h";i:0;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";i:9999999999990;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";b:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}';
var_dump(unserialize($payload));
?>
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
int(1)
["m"]=>
int(0)
["d"]=>
int(4)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(-1)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
+16
View File
@@ -43,10 +43,18 @@ DBA_OPEN_FUNC(lmdb)
MDB_env *env;
MDB_txn *txn;
int rc, mode = 0644, flags = MDB_NOSUBDIR;
zend_long mapsize = 0;
if(info->argc > 0) {
mode = zval_get_long(&info->argv[0]);
if (info->argc > 1) {
mapsize = zval_get_long(&info->argv[1]);
if (mapsize < 0) {
*error = "mapsize must be greater than or equal to zero";
return FAILURE;
}
}
/* TODO implement handling of the additional flags. */
}
@@ -56,6 +64,14 @@ DBA_OPEN_FUNC(lmdb)
return FAILURE;
}
if (mapsize > 0) {
rc = mdb_env_set_mapsize(env, (size_t) mapsize);
if (rc) {
*error = mdb_strerror(rc);
return FAILURE;
}
}
rc = mdb_env_open(env, info->path, flags, mode);
if (rc) {
*error = mdb_strerror(rc);
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached)
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
$handler = 'lmdb';
require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$handler = 'lmdb';
require_once __DIR__ .'/test.inc';
$lmdb_h = dba_open($db_filename, 'c', 'lmdb', 0644, 5*1048576);
for ($i = 0; $i < 50000; $i++) {
dba_insert('key' . $i, 'value '. $i, $lmdb_h);
}
dba_close($lmdb_h);
echo "done\n";
?>
--EXPECT--
done
--CLEAN--
<?php
require_once dirname(__FILE__) .'/clean.inc';
?>
+5 -3
View File
@@ -3138,7 +3138,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
continue;
if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
if (maker_note->id_string && value_len >= maker_note->id_string_len
&& strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
continue;
break;
}
@@ -3212,8 +3213,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
}
for (de=0;de<NumDirEntries;de++) {
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
size_t offset = 2 + 12 * de;
if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table)) {
return FALSE;
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal f
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > %s) in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #78793: Use-after-free in exif parsing under memory sanitizer
--FILE--
<?php
$f = "ext/exif/tests/bug77950.tiff";
for ($i = 0; $i < 10; $i++) {
@exif_read_data($f);
}
?>
===DONE===
--EXPECT--
===DONE===
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044)
--FILE--
<?php
var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBDwAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN'));
?>
--EXPECTF--
Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote ): Illegal format code 0x2020, switching to BYTE in %s on line %d
Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0x2020, suppose BYTE in %s on line %d
Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d
Warning: exif_read_data(): Invalid TIFF file in %s on line %d
bool(false)
+1 -4
View File
@@ -477,11 +477,9 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
zend_string *repl;
size_t rep_cnt = 0;
(void)setlocale(LC_CTYPE, "C");
opts |= PCRE2_MULTILINE;
convert_libmagic_pattern(&patt, (char*)pat, strlen(pat), opts);
if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
if ((pce = pcre_get_compiled_regex_cache_ex(Z_STR(patt), 0)) == NULL) {
zval_ptr_dtor(&patt);
rep_cnt = -1;
goto out;
@@ -503,7 +501,6 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
zend_string_release_ex(res, 0);
out:
(void)setlocale(LC_CTYPE, "");
return rep_cnt;
}
+14 -4
View File
@@ -116,14 +116,24 @@ cdf_app_to_mime(const char *vbuf, const struct nv *nv)
{
size_t i;
const char *rv = NULL;
char *vbuf_lower;
(void)setlocale(LC_CTYPE, "C");
for (i = 0; nv[i].pattern != NULL; i++)
if (strcasestr(vbuf, nv[i].pattern) != NULL) {
vbuf_lower = zend_str_tolower_dup(vbuf, strlen(vbuf));
for (i = 0; nv[i].pattern != NULL; i++) {
char *pattern_lower;
int found;
pattern_lower = zend_str_tolower_dup(nv[i].pattern, strlen(nv[i].pattern));
found = (strstr(vbuf_lower, pattern_lower) != NULL);
efree(pattern_lower);
if (found) {
rv = nv[i].mime;
break;
}
(void)setlocale(LC_CTYPE, "");
}
efree(vbuf_lower);
return rv;
}
+6 -8
View File
@@ -422,27 +422,25 @@ flush:
private int
check_fmt(struct magic_set *ms, const char *fmt)
{
pcre2_code *pce;
uint32_t re_options, capture_count;
pcre_cache_entry *pce;
int rv = -1;
zend_string *pattern;
if (strchr(fmt, '%') == NULL)
return 0;
(void)setlocale(LC_CTYPE, "C");
pattern = zend_string_init("~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, 0);
if ((pce = pcre_get_compiled_regex(pattern, &capture_count, &re_options)) == NULL) {
if ((pce = pcre_get_compiled_regex_cache_ex(pattern, 0)) == NULL) {
rv = -1;
} else {
pcre2_match_data *match_data = php_pcre_create_match_data(capture_count, pce);
pcre2_code *re = php_pcre_pce_re(pce);
pcre2_match_data *match_data = php_pcre_create_match_data(0, re);
if (match_data) {
rv = pcre2_match(pce, (PCRE2_SPTR)fmt, strlen(fmt), 0, re_options, match_data, php_pcre_mctx()) > 0;
rv = pcre2_match(re, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
php_pcre_free_match_data(match_data);
}
}
zend_string_release_ex(pattern, 0);
(void)setlocale(LC_CTYPE, "");
zend_string_release(pattern);
return rv;
}
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #74170 locale information change after mime_content_type
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (setlocale(LC_CTYPE, 'ru_RU.koi8r') === false)
die('skip ru_RU.koi8r locale is not available');
?>
--FILE--
<?php
var_dump(setlocale(LC_CTYPE, 'ru_RU.koi8r'));
var_dump(nl_langinfo(CODESET));
var_dump(mime_content_type(__DIR__ . '/resources/test.ppt'));
var_dump(nl_langinfo(CODESET));
--EXPECT--
string(11) "ru_RU.koi8r"
string(6) "KOI8-R"
string(29) "application/vnd.ms-powerpoint"
string(6) "KOI8-R"
+1
View File
@@ -264,6 +264,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
for ( y=0; y<src->sy; y++) {
for(x=0; x<src->sx; x++) {
new_r = new_g = new_b = 0;
pxl = f(srcback, x, y);
new_a = gdImageAlpha(srcback, pxl);
for (j=0; j<3; j++) {
+1 -1
View File
@@ -534,7 +534,7 @@ compress(int init_bits, gdIOCtxPtr outfile, gdImagePtr im, GifCtx *ctx)
output( (code_int)ctx->ClearCode, ctx );
#ifdef SIGNED_COMPARE_SLOW
while ( (c = GIFNextPixel( im )) != (unsigned) EOF ) {
while ( (c = GIFNextPixel( im, ctx )) != (unsigned) EOF ) {
#else /*SIGNED_COMPARE_SLOW*/
while ( (c = GIFNextPixel( im, ctx )) != EOF ) { /* } */
#endif /*SIGNED_COMPARE_SLOW*/
+6 -3
View File
@@ -2334,7 +2334,7 @@ int gdTransformAffineGetImage(gdImagePtr *dst,
* src_area - Rectangular region to rotate in the src image
*
* Returns:
* GD_TRUE if the affine is rectilinear or GD_FALSE
* GD_TRUE on success or GD_FALSE on failure
*/
int gdTransformAffineCopy(gdImagePtr dst,
int dst_x, int dst_y,
@@ -2351,7 +2351,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
gdPointF pt, src_pt;
gdRect bbox;
int end_x, end_y;
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
interpolation_method interpolation_bak;
/* These methods use special implementations */
@@ -2393,7 +2393,10 @@ int gdTransformAffineCopy(gdImagePtr dst,
end_y = bbox.height + (int) fabs(bbox.y);
/* Get inverse affine to let us work with destination -> source */
gdAffineInvert(inv, affine);
if (gdAffineInvert(inv, affine) == GD_FALSE) {
gdImageSetInterpolationMethod(src, interpolation_id_bak);
return GD_FALSE;
}
src_offset_x = src_region->x;
src_offset_y = src_region->y;
+1 -1
View File
@@ -55,7 +55,7 @@ int gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src,
* <gdAffineIdentity>
*
* Returns:
* GD_TRUE if the affine is rectilinear or GD_FALSE
* GD_TRUE on success or GD_FALSE on failure
*/
int gdAffineInvert (double dst[6], const double src[6])
{
+1 -3
View File
@@ -1,11 +1,9 @@
--TEST--
Bug #47946 (ImageConvolution overwrites background)
--DESCRIPTION--
The expected image has black pixel artifacts, what is another issue, though
(perhaps #40158).
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
?>
--FILE--
<?php
Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 355 B

+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #79067 (gdTransformAffineCopy() may use unitialized values)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$matrix = [1, 1, 1, 1, 1, 1];
$src = imagecreatetruecolor(8, 8);
var_dump(imageaffine($src, $matrix));
?>
--EXPECT--
bool(false)
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #79068 (gdTransformAffineCopy() changes interpolation method)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';
$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
imageline($src, 10, 10, 90, 90, 0x000000);
imagesetinterpolation($src, IMG_BSPLINE);
imageaffine($src, [1, 1, 1, 1, 1, 1]);
$dst = imagerotate($src, 80, 0xffffff);
test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
?>
--EXPECT--
The images are equal.
Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

+2 -2
View File
@@ -1285,7 +1285,7 @@ PHP_FUNCTION(locale_filter_matches)
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize loc_range" , 0 );
RETURN_FALSE;
@@ -1293,7 +1293,7 @@ PHP_FUNCTION(locale_filter_matches)
/* canonicalize lang_tag */
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize lang_tag" , 0 );
RETURN_FALSE;
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #78804: Segmentation fault in Locale::filterMatches
--FILE--
<?php
if (Locale::filterMatches('en-US', 'und', true)) {
echo 'Matches';
} else {
echo 'Not matches';
}
?>
--EXPECT--
Not matches
+4
View File
@@ -358,6 +358,10 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
context = php_stream_context_from_zval(Z_ISUNDEF(LIBXML(stream_context))? NULL : &LIBXML(stream_context), 0);
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
if (ret_val) {
/* Prevent from closing this by fclose() */
((php_stream*)ret_val)->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
}
if (isescaped) {
xmlFree(resolved_path);
}
+26 -1
View File
@@ -1,8 +1,33 @@
History
2019/11/29: Version 6.9.4
2019/11/22: Release Candidate 3 for Version 6.9.4
2019/11/20: fix a problem found by libFuzzer test
2019/11/14: Release Candidate 2 for Version 6.9.4
2019/11/12: fix integer overflow by nested quantifier
2019/11/11: fix CVE-2019-19012: Integer overflow related to reg->dmax in search_in_range()
2019/11/07: fix CVE-2019-19203: heap-buffer-overflow in gb18030_mbc_enc_len()
2019/11/06: fix CVE-2019-19204: heap-buffer-overflow in fetch_interval_quantifier()
2019/11/06: add HAVE_INTTYPES_H into config.h.windows.in and config.h.win{32,64}
2019/11/06: add HAVE_STDINT_H into config.h.win{32,64}
2019/11/05: Release Candidate 1 for Version 6.9.4
2019/10/31: Update Unicode Emoji version to 12.1 (Nothing data changed)
2019/10/29: implement USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR configuration
2019/10/18: re-implement case fold conversion
2019/10/04: fix #156: Heap buffer overflow in match_at() with case-insensitive match
2019/09/30: NEW API: add onig_regset_replace()
2019/09/30: change Unicode VERSION value format
2019/09/20: NEW API: add regset functions
2019/09/20: add data ensure check before peek string value in OP_PUSH_IF_PEEK_NEXT
2019/09/20: fix loose code in encode-harness.c
2019/08/13: fix heap-buffer-overflow
2019/08/13: Add a macro to disable direct threading in the match engine (PR#149)
2019/08/06: Version 6.9.3 (secirity fix release)
2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE
2019/07/30: add ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC
2019/07/29: add STK_PREC_READ_START/END stack type
2019/07/29: Fix #147: Stack Exhaustion Problem caused by some parsing functions
2019/07/11: add a dictionary file for libfuzzer
+26 -14
View File
@@ -27,25 +27,34 @@ Supported character encodings:
* doc/SYNTAX.md: contributed by seanofw
Version 6.9.4
-------------
* NEW API: RegSet (set of regexes)
* Fixed CVE-2019-19012
* Fixed CVE-2019-19203 (Does not affect UTF-8, UTF-16 and UTF-32 encodings)
* Fixed CVE-2019-19204 (Affects only PosixBasic, Emacs and Grep syntaxes)
* Fixed CVE-2019-19246
* Fixed some problems (found by libFuzzer test)
Version 6.9.3 (security fix release)
------------------------------------
* Fixed CVE-2019-13224
* Fixed CVE-2019-13225
* Fixed many problems (found by libfuzzer programs)
* Fixed CVE-2019-16163
* Fixed many problems (found by libFuzzer test)
Version 6.9.2 (Reiwa)
---------------------
* add doc/SYNTAX.md
* Direct threaded code (for GCC and Clang)
* Update Unicode version 12.1.0
* NEW: Unicode Text Segment mode option (?y{g}) (?y{w}) (*original)
g: Extended Grapheme Cluster mode / w: Word mode
(Unicode Standard Annex #29 [http://unicode.org/reports/tr29/])
Version 6.9.1
-------------
@@ -118,7 +127,7 @@ Version 6.5.0
* NEW: \O (true anychar)
* NEW: if-then-else (?(...)...\|...)
* NEW: Backreference validity checker (?(xxx)) (*original)
* NEW: Absent repeater (?~absent) \[is equal to (?\~\|absent|\O*)]
* NEW: Absent repeater (?~absent) \[is equal to (?\~\|(?:absent)|\O*)]
* NEW: Absent expression (?~|absent|expr) (*original)
* NEW: Absent stopper (?~|absent) (*original)
@@ -244,15 +253,18 @@ Sample Programs
|File |Description |
|:---------------------|:-----------------------------------------|
|sample/callout.c |example of callouts |
|sample/count.c |example of built-in callout *COUNT |
|sample/echo.c |example of user defined callouts of name |
|sample/encode.c |example of some encodings |
|sample/listcap.c |example of the capture history |
|sample/names.c |example of the named group callback |
|sample/posix.c |POSIX API sample |
|sample/regset.c |example of using RegSet API |
|sample/scan.c |example of using onig_scan() |
|sample/simple.c |example of the minimum (Oniguruma API) |
|sample/names.c |example of the named group callback. |
|sample/encode.c |example of some encodings. |
|sample/listcap.c |example of the capture history. |
|sample/posix.c |POSIX API sample. |
|sample/scan.c |example of using onig_scan(). |
|sample/sql.c |example of the variable meta characters. |
|sample/user_property.c|example of user defined Unicode property. |
|sample/callout.c |example of callouts. |
|sample/sql.c |example of the variable meta characters |
|sample/user_property.c|example of user defined Unicode property |
Test Programs
+135 -3
View File
@@ -1,4 +1,4 @@
Oniguruma API Version 6.9.3 2019/07/06
Oniguruma API Version 6.9.4 2019/09/30
#include <oniguruma.h>
@@ -168,7 +168,7 @@ Oniguruma API Version 6.9.3 2019/07/06
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
OnigCompileInfo* ci, OnigErrorInfo* einfo)
This function is deprecate, and it does not allow the case where
This function is deprecated, and it does not allow the case where
the encoding of pattern and target is different.
Create a regex object.
@@ -306,6 +306,7 @@ Oniguruma API Version 6.9.3 2019/07/06
normal return: match position offset (i.e. p - str >= 0)
not found: ONIG_MISMATCH (< 0)
error: error code (< 0)
arguments
1 reg: regex object
@@ -342,7 +343,8 @@ Oniguruma API Version 6.9.3 2019/07/06
Do not pass invalid byte string in the regex character encoding.
normal return: match length (>= 0)
not match: ONIG_MISMATCH ( < 0)
not match: ONIG_MISMATCH (< 0)
error: error code (< 0)
arguments
1 reg: regex object
@@ -391,6 +393,136 @@ Oniguruma API Version 6.9.3 2019/07/06
7 callback_arg: optional argument passed to callback
# int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
Create a regset object.
All regex objects must have the same character encoding.
All regex objects are prohibited from having the ONIG_OPTION_FIND_LONGEST option.
arguments
1 rset: return address of regset object
2 n: number of regex in regs
3 regs: array of regex
normal return: ONIG_NORMAL
# int onig_regset_add(OnigRegSet* set, regex_t* reg)
Add a regex into regset.
The regex object must have the same character encoding with the regset.
The regex object is prohibited from having the ONIG_OPTION_FIND_LONGEST option.
arguments
1 set: regset object
2 reg: regex object
normal return: ONIG_NORMAL
# int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
Replace a regex in regset with another one.
If the reg argument value is NULL, then remove at-th regex. (and indexes of other regexes are changed)
arguments
1 set: regset object
2 at: index of regex (zero origin)
3 reg: regex object
normal return: ONIG_NORMAL
# void onig_regset_free(OnigRegSet* set)
Free memory used by regset object and regex objects in the regset.
If the same regex object is registered twice, the situation becomes destructive.
arguments
1 set: regset object
# int onig_regset_number_of_regex(OnigRegSet* set)
Returns number of regex objects in the regset.
arguments
1 set: regset object
# regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
Returns the regex object corresponding to the at-th regex.
arguments
1 set: regset object
2 at: index of regex array (zero origin)
# OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
Returns the region object corresponding to the at-th regex.
arguments
1 set: regset object
2 at: index of regex array (zero origin)
# 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)
Perform a search with regset.
return value:
normal return: index of match regex (zero origin)
not found: ONIG_MISMATCH (< 0)
error: error code (< 0)
arguments
1 set: regset object
2 str: target string
3 end: terminate address of target string
4 start: search start address of target string
5 range: search terminate address of target string
6 lead: outer loop element
ONIG_REGSET_POSITION_LEAD (returns most left position)
ONIG_REGSET_REGEX_LEAD (returns most left position)
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
7 option: search time option
ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
8 rmatch_pos: return address of match position (match_address - str)
* ONIG_REGSET_POSITION_LEAD and ONIG_REGSET_REGEX_LEAD return the same result.
These differences only appear in search time.
In most cases, ONIG_REGSET_POSITION_LEAD seems to be faster.
# 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)
Perform a search with regset and match-params.
return value:
normal return: index of match regex (zero origin)
not found: ONIG_MISMATCH (< 0)
error: error code (< 0)
arguments
1 set: regset object
2 str: target string
3 end: terminate address of target string
4 start: search start address of target string
5 range: search terminate address of target string
6 lead: outer loop element
ONIG_REGSET_POSITION_LEAD (returns most left position)
ONIG_REGSET_REGEX_LEAD (returns most left position)
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (returns first match regex)
7 option: search time option
ONIG_OPTION_NOTBOL string head(str) isn't considered as begin of line
ONIG_OPTION_NOTEOL string end (end) isn't considered as end of line
8 mps: array of match-params
9 rmatch_pos: return address of match position (match_address - str)
# OnigRegion* onig_region_new(void)
Create a region.
+133 -1
View File
@@ -1,4 +1,4 @@
鬼車インターフェース Version 6.9.3 2019/07/06
鬼車インターフェース Version 6.9.4 2019/09/30
#include <oniguruma.h>
@@ -390,6 +390,138 @@
7 callback_arg: コールバック関数に渡される付加引数値
# int onig_regset_new(OnigRegSet** rset, int n, regex_t* regs[])
regsetオブジェクトを生成する。
全ての正規表現オブジェクトは、同じ文字エンコーディングでなければならない。
全ての正規表現オブジェクトは、ONIG_OPTION_FIND_LONGESTオプションでコンパイルされていてはならない。
引数
1 rset: regsetオブジェクトを返すためのアドレス
2 n: 正規表現の個数
3 regs: 正規表現オブジェクトの配列
正常終了戻り値: ONIG_NORMAL
# int onig_regset_add(OnigRegSet* set, regex_t* reg)
regsetオブジェクトに正規表現を追加する。
正規表現オブジェクトは、regsetと同じ文字エンコーディングでなければならない。
正規表現オブジェクトは、ONIG_OPTION_FIND_LONGESTオプションでコンパイルされていてはならない。
引数
1 set: regsetオブジェクト
2 reg: 正規表現オブジェクト
正常終了戻り値: ONIG_NORMAL
# int onig_regset_replace(OnigRegSet* set, int at, regex_t* reg)
regsetの中の一個の正規表現オブジェクトを別のものに変更する。
若しreg引数の値がNULLであれば、at番目の正規表現オブジェクトを外す。(そして、以降の正規表現オブジェクトのインデックスは変化する)
引数
1 set: regsetオブジェクト
2 at: 変更する場所のインデックス
2 reg: 正規表現オブジェクト
正常終了戻り値: ONIG_NORMAL
# void onig_regset_free(OnigRegSet* set)
regsetオブジェクトとその中の正規表現オブジェクトの使用メモリを開放する。
若し、同一の正規表現オブジェクトを重複して登録していれば、破壊的な状況になる。
引数
1 set: regsetオブジェクト
# int onig_regset_number_of_regex(OnigRegSet* set)
regsetの中の正規表現オブジェクトの個数を返す。
引数
1 set: regsetオブジェクト
# regex_t* onig_regset_get_regex(OnigRegSet* set, int at)
regsetのat番目の正規表現を返す。
引数
1 set: regsetオブジェクト
2 at: 正規表現オブジェクトのインデックス (ゼロ開始)
# OnigRegion* onig_regset_get_region(OnigRegSet* set, int at)
regsetのat番目の正規表現に対応する領域を返す。
引数
1 set: regsetオブジェクト
2 at: 正規表現オブジェクトのインデックス (ゼロ開始)
# 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)
regsetによる検索を実行する。
戻り値:
検索成功: マッチした正規表現オブジェクトのインデックス (ゼロ開始)
検索失敗: ONIG_MISMATCH (< 0)
エラー: エラーコード (< 0)
引数
1 set: regsetオブジェクト
2 str: 検索対象文字列
3 end: 検索対象文字列の終端アドレス
4 start: 検索対象文字列の検索先頭位置アドレス
5 range: 検索対象文字列の検索終了位置アドレス
(start <= 探索される文字列 < range)
6 lead: 外側のループ要素
ONIG_REGSET_POSITION_LEAD (最左位置でマッチした結果を返す)
ONIG_REGSET_REGEX_LEAD (最左位置でマッチした結果を返す)
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (最初にマッチした正規表現の結果を返す)
7 option: 検索時オプション
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
8 rmatch_pos: マッチした位置を返すためのアドレス (match_address - str)
* ONIG_REGSET_POSITION_LEADとONIG_REGSET_REGEX_LEADは同じ結果を返す。
これらの違いは検索時間にしか現れない。
ほとんどの場合、ONIG_REGSET_POSITION_LEADのほうが速いと思われる。
# 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)
regsetとOnigMatchParamオブジェクトによる検索を実行する。
戻り値:
検索成功: マッチした正規表現オブジェクトのインデックス (ゼロ開始)
検索失敗: ONIG_MISMATCH (< 0)
エラー: エラーコード (< 0)
引数
1 set: regsetオブジェクト
2 str: 検索対象文字列
3 end: 検索対象文字列の終端アドレス
4 start: 検索対象文字列の検索先頭位置アドレス
5 range: 検索対象文字列の検索終了位置アドレス
(start <= 探索される文字列 < range)
6 lead: 外側のループ要素
ONIG_REGSET_POSITION_LEAD (最左位置でマッチした結果を返す)
ONIG_REGSET_REGEX_LEAD (最左位置でマッチした結果を返す)
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER (最初にマッチした正規表現の結果を返す)
7 option: 検索時オプション
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
8 mps: OnigMatchParamオブジェクトの配列
9 rmatch_pos: マッチした位置を返すためのアドレス (match_address - str)
# OnigRegion* onig_region_new(void)
マッチ領域情報(region)を作成する。
+7 -2
View File
@@ -1,4 +1,4 @@
Oniguruma Regular Expressions Version 6.9.2 2019/03/29
Oniguruma Regular Expressions Version 6.9.4 2019/10/31
syntax: ONIG_SYNTAX_ONIGURUMA (default)
@@ -289,6 +289,11 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
In negative look-behind, capturing group isn't allowed,
but non-capturing group (?:) is allowed.
* In look-behind and negative look-behind, support for
ignore-case option is limited. Only supports conversion
between single characters. (Does not support conversion
of multiple characters in Unicode)
(?>subexp) atomic group
no backtracks in subexp.
@@ -338,7 +343,7 @@ syntax: ONIG_SYNTAX_ONIGURUMA (default)
This works like .* (more precisely \O*), but it is
limited by the range that does not include the string
match with <absent>.
This is a written abbreviation of (?~|absent|\O*).
This is a written abbreviation of (?~|(?:absent)|\O*).
\O* is used as a repeater.
(?~|absent|exp) Absent expression (* original)
+14 -10
View File
@@ -1,4 +1,4 @@
鬼車 正規表現 Version 6.9.2 2019/03/29
鬼車 正規表現 Version 6.9.4 2019/10/31
使用文法: ONIG_SYNTAX_ONIGURUMA (既定値)
@@ -21,10 +21,10 @@
\f 改頁 (0x0C)
\a 鐘 (0x07)
\e 退避修飾 (0x1B)
\nnn 八進数表現 符号化バイト値(の一部)
\nnn 八進数表現 符号化バイト値
\o{17777777777} 拡張八進数表現 コードポイント値
\uHHHH 拡張十六進数表現 コードポイント値
\xHH 十六進数表現 符号化バイト値(の一部)
\xHH 十六進数表現 符号化バイト値
\x{7HHHHHHH} 拡張十六進数表現 コードポイント値
\cx 制御文字表現 コードポイント値
\C-x 制御文字表現 コードポイント値
@@ -284,6 +284,10 @@
否定戻り読みでは、捕獲式集合は許されないが、
非捕獲式集合は許される。
* 戻り読み、否定戻り読みの中では、ignore-caseオプションの
対応が制限される。一文字と一文字の間の変換しか対応しない。
(Unicodeでの複数文字の変換に対応しない)
(?>式) 原子的式集合
式全体を通過したとき、式の中での後退再試行を行なわない
@@ -334,20 +338,20 @@
<不在機能群>
(?~不在式) 不在繰り返し (*原案 田中哲)
これは .*(より正確には\O*)のように動作するが、<不在式>に
(?~不在) 不在繰り返し (*原案 田中哲)
これは .*(より正確には\O*)のように動作するが、<不在>に
適合する文字列を含まない範囲に制限される。
これは(?~|不在式|\O*)の省略表記である。
これは(?~|(?:不在)|\O*)の省略表記である。
(?~|不在式|式) 不在式 (* 原作)
これは<式>のように動作するが、<不在式>に適合する文字列を
(?~|不在|式) 不在式 (* 原作)
これは<式>のように動作するが、<不在>に適合する文字列を
含まない範囲に制限される。
例 (?~|345|\d*) "12345678" ==> "12", "1", ""
(?~|不在式) 不在停止 (* 原作)
(?~|不在) 不在停止 (* 原作)
この演算子を通過した後は、対象文字列の適合範囲が
<不在式>に適合する文字列を含まない範囲に制限される。
<不在>に適合する文字列を含まない範囲に制限される。
(?~|) 範囲消去
不在停止の効果を消して、それ以前の状態にする。
+8 -1
View File
@@ -1,7 +1,7 @@
# Oniguruma syntax (operator) configuration
_Documented for Oniguruma 6.9.2 (2019/03/28)_
_Documented for Oniguruma 6.9.3 (2019/08/08)_
----------
@@ -960,6 +960,12 @@ _Set in: Ruby, Oniguruma_
If this flag is set, Oniguruma will warn about nested repeat operators those have no meaning, like `(?:a*)+`.
If this flag is clear, Oniguruma will allow the nested repeat operators without warning about them.
### 26. ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC (allow [a-\x{7fffffff}])
_Set in: Oniguruma_
If this flag is set, then invalid code points at the end of range in character class are allowed.
### 31. ONIG_SYN_CONTEXT_INDEP_ANCHORS
_Set in: PosixExtended, GnuRegex, Java, Perl, Perl_NG, Ruby, Oniguruma_
@@ -1066,4 +1072,5 @@ These tables show which of the built-in syntaxes use which flags and options, fo
| 23 | `ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC` | - | Yes | - | - | Yes | Yes | Yes | Yes | Yes | Yes |
| 24 | `ONIG_SYN_WARN_CC_OP_NOT_ESCAPED` | - | - | - | - | - | - | - | - | Yes | Yes |
| 25 | `ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT` | - | - | - | - | - | - | - | - | Yes | Yes |
| 26 | `ONIG_SYN_ALLOW_INVALID_CODE_END_OF_RANGE_IN_CC` | - | - | - | - | - | - | - | - | - | Yes |
| 31 | `ONIG_SYN_CONTEXT_INDEP_ANCHORS` | - | Yes | - | - | Yes | Yes | Yes | Yes | Yes | Yes |
@@ -1,4 +1,4 @@
Unicode Properties (from Unicode Version: 12.1.0)
Unicode Properties (Unicode Version: 12.1.0, Emoji: 12.1)
15: ASCII_Hex_Digit
16: Adlam
+1 -1
View File
@@ -2,7 +2,7 @@
ascii.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+12 -11
View File
@@ -2,7 +2,7 @@
big5.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,16 @@ big5_mbc_enc_len(const UChar* p)
return EncLen_BIG5[*p];
}
static int
big5_code_to_mbclen(OnigCodePoint code)
{
if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
if ((code & 0xff00) != 0) return 2;
if (EncLen_BIG5[(int )(code & 0xff)] == 1) return 1;
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
static int
is_valid_mbc_string(const UChar* p, const UChar* end)
{
@@ -99,15 +109,6 @@ big5_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
pp, end, lower);
}
#if 0
static int
big5_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_BIG5, flag, pp, end);
}
#endif
static int
big5_is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
@@ -174,7 +175,7 @@ OnigEncodingType OnigEncodingBIG5 = {
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
big5_mbc_to_code,
onigenc_mb2_code_to_mbclen,
big5_code_to_mbclen,
big5_code_to_mbc,
big5_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
+56 -82
View File
@@ -1,82 +1,56 @@
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_FLOAT_H 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 8
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_SIZE_T 4
#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
#define HAVE_STDARG_PROTOTYPES 1
#ifndef NORETURN
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#else
#define NORETURN(x) x
#endif
#endif
#define HAVE_DECL_SYS_NERR 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_LIMITS_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_MEMORY_H 1
#define uid_t int
#define gid_t int
#define GETGROUPS_T int
#define HAVE_ALLOCA 1
#define HAVE_DUP2 1
#define HAVE_MEMCMP 1
#define HAVE_MEMMOVE 1
#define HAVE_MKDIR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOD 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_FLOCK 1
#define HAVE_VSNPRINTF 1
#define HAVE_FINITE 1
#define HAVE_FMOD 1
#define HAVE_FREXP 1
#define HAVE_HYPOT 1
#define HAVE_MODF 1
#define HAVE_WAITPID 1
#define HAVE_CHSIZE 1
#define HAVE_TIMES 1
#define HAVE__SETJMP 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_MKTIME 1
#define HAVE_COSH 1
#define HAVE_SINH 1
#define HAVE_TANH 1
#define HAVE_EXECVE 1
#define HAVE_TZNAME 1
#define HAVE_DAYLIGHT 1
#define SETPGRP_VOID 1
#define inline __inline
#define NEED_IO_SEEK_BETWEEN_RW 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define DEFAULT_KCODE KCODE_NONE
#define DLEXT ".so"
#define DLEXT2 ".dll"
#if defined(__MINGW32__) || _MSC_VER >= 1600
#define HAVE_STDINT_H 1
#endif
#if defined(__MINGW32__) || _MSC_VER >= 1800
#define HAVE_INTTYPES_H 1
#endif
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_MEMORY_H 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 8
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_SIZE_T 4
#define TOKEN_PASTE(x,y) x##y
#ifndef NORETURN
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#else
#define NORETURN(x) x
#endif
#endif
#define HAVE_DECL_SYS_NERR 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_MEMORY_H 1
#define uid_t int
#define gid_t int
#define GETGROUPS_T int
#define HAVE_ALLOCA 1
#define HAVE_DUP2 1
#define HAVE_MKDIR 1
#define HAVE_FLOCK 1
#define HAVE_FINITE 1
#define HAVE_HYPOT 1
#define HAVE_WAITPID 1
#define HAVE_CHSIZE 1
#define HAVE_TIMES 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_EXECVE 1
#define HAVE_DAYLIGHT 1
#define SETPGRP_VOID 1
#define inline __inline
#define NEED_IO_SEEK_BETWEEN_RW 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define DEFAULT_KCODE KCODE_NONE
#define DLEXT ".so"
#define DLEXT2 ".dll"
+56 -82
View File
@@ -1,82 +1,56 @@
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_FLOAT_H 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 8
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 8
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_SIZE_T 8
#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
#define HAVE_STDARG_PROTOTYPES 1
#ifndef NORETURN
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#else
#define NORETURN(x) x
#endif
#endif
#define HAVE_DECL_SYS_NERR 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_LIMITS_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_MEMORY_H 1
#define uid_t int
#define gid_t int
#define GETGROUPS_T int
#define HAVE_ALLOCA 1
#define HAVE_DUP2 1
#define HAVE_MEMCMP 1
#define HAVE_MEMMOVE 1
#define HAVE_MKDIR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOD 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_FLOCK 1
#define HAVE_VSNPRINTF 1
#define HAVE_FINITE 1
#define HAVE_FMOD 1
#define HAVE_FREXP 1
#define HAVE_HYPOT 1
#define HAVE_MODF 1
#define HAVE_WAITPID 1
#define HAVE_CHSIZE 1
#define HAVE_TIMES 1
#define HAVE__SETJMP 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_MKTIME 1
#define HAVE_COSH 1
#define HAVE_SINH 1
#define HAVE_TANH 1
#define HAVE_EXECVE 1
#define HAVE_TZNAME 1
#define HAVE_DAYLIGHT 1
#define SETPGRP_VOID 1
#define inline __inline
#define NEED_IO_SEEK_BETWEEN_RW 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define DEFAULT_KCODE KCODE_NONE
#define DLEXT ".so"
#define DLEXT2 ".dll"
#if defined(__MINGW32__) || _MSC_VER >= 1600
#define HAVE_STDINT_H 1
#endif
#if defined(__MINGW32__) || _MSC_VER >= 1800
#define HAVE_INTTYPES_H 1
#endif
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_MEMORY_H 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 8
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 8
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_SIZE_T 8
#define TOKEN_PASTE(x,y) x##y
#ifndef NORETURN
#if _MSC_VER > 1100
#define NORETURN(x) __declspec(noreturn) x
#else
#define NORETURN(x) x
#endif
#endif
#define HAVE_DECL_SYS_NERR 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_MEMORY_H 1
#define uid_t int
#define gid_t int
#define GETGROUPS_T int
#define HAVE_ALLOCA 1
#define HAVE_DUP2 1
#define HAVE_MKDIR 1
#define HAVE_FLOCK 1
#define HAVE_FINITE 1
#define HAVE_HYPOT 1
#define HAVE_WAITPID 1
#define HAVE_CHSIZE 1
#define HAVE_TIMES 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_EXECVE 1
#define HAVE_DAYLIGHT 1
#define SETPGRP_VOID 1
#define inline __inline
#define NEED_IO_SEEK_BETWEEN_RW 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define DEFAULT_KCODE KCODE_NONE
#define DLEXT ".so"
#define DLEXT2 ".dll"
+2 -2
View File
@@ -2,8 +2,8 @@
cp1251.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2006-2018 Byte <byte AT mail DOT kna DOT ru>
* K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2006-2019 Byte <byte AT mail DOT kna DOT ru>
* K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -20
View File
@@ -2,7 +2,7 @@
euc_jp.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -120,25 +120,6 @@ code_to_mbclen(OnigCodePoint code)
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
#if 0
static int
code_to_mbc_first(OnigCodePoint code)
{
int first;
if ((code & 0xff0000) != 0) {
first = (code >> 16) & 0xff;
}
else if ((code & 0xff00) != 0) {
first = (code >> 8) & 0xff;
}
else {
return (int )code;
}
return first;
}
#endif
static int
code_to_mbc(OnigCodePoint code, UChar *buf)
{
+1 -1
View File
@@ -1,5 +1,5 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: /usr/local/bin/gperf -pt -T -L ANSI-C -N onigenc_euc_jp_lookup_property_name --output-file gperf1.tmp euc_jp_prop.gperf */
/* Command-line: gperf -pt -T -L ANSI-C -N onigenc_euc_jp_lookup_property_name --output-file gperf1.tmp euc_jp_prop.gperf */
/* Computed positions: -k'1,3' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+13 -12
View File
@@ -2,7 +2,7 @@
euc_kr.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,16 @@ euckr_mbc_enc_len(const UChar* p)
return EncLen_EUCKR[*p];
}
static int
euckr_code_to_mbclen(OnigCodePoint code)
{
if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
if ((code & 0xff00) != 0) return 2;
if (EncLen_EUCKR[(int )(code & 0xff)] == 1) return 1;
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
static int
is_valid_mbc_string(const UChar* p, const UChar* end)
{
@@ -98,15 +108,6 @@ euckr_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
pp, end, lower);
}
#if 0
static int
euckr_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_EUC_KR, flag, pp, end);
}
#endif
static int
euckr_is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
@@ -149,7 +150,7 @@ OnigEncodingType OnigEncodingEUC_KR = {
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
euckr_mbc_to_code,
onigenc_mb2_code_to_mbclen,
euckr_code_to_mbclen,
euckr_code_to_mbc,
euckr_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
@@ -174,7 +175,7 @@ OnigEncodingType OnigEncodingEUC_CN = {
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
euckr_mbc_to_code,
onigenc_mb2_code_to_mbclen,
euckr_code_to_mbclen,
euckr_code_to_mbc,
euckr_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
+16 -2
View File
@@ -2,7 +2,7 @@
euc_tw.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,20 @@ euctw_mbc_enc_len(const UChar* p)
return EncLen_EUCTW[*p];
}
static int
euctw_code_to_mbclen(OnigCodePoint code)
{
if ((code & 0xff000000) != 0) return 4;
else if ((code & 0xff0000) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
else if ((code & 0xff00) != 0) return 2;
else {
if (EncLen_EUCTW[(int )(code & 0xff)] == 1)
return 1;
return ONIGERR_INVALID_CODE_POINT_VALUE;
}
}
static int
is_valid_mbc_string(const UChar* p, const UChar* end)
{
@@ -155,7 +169,7 @@ OnigEncodingType OnigEncodingEUC_TW = {
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
euctw_mbc_to_code,
onigenc_mb4_code_to_mbclen,
euctw_code_to_mbclen,
euctw_code_to_mbc,
euctw_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
+17 -11
View File
@@ -3,7 +3,7 @@
**********************************************************************/
/*-
* Copyright (c) 2005-2019 KUBO Takehiro <kubo AT jiubao DOT org>
* K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,6 +33,7 @@
#if 1
#define DEBUG_GB18030(arg)
#else
#include <stdio.h>
#define DEBUG_GB18030(arg) printf arg
#endif
@@ -75,6 +76,20 @@ gb18030_mbc_enc_len(const UChar* p)
return 2;
}
static int
gb18030_code_to_mbclen(OnigCodePoint code)
{
if ((code & 0xff000000) != 0) return 4;
else if ((code & 0xff0000) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
else if ((code & 0xff00) != 0) return 2;
else {
if (GB18030_MAP[(int )(code & 0xff)] == CM)
return ONIGERR_INVALID_CODE_POINT_VALUE;
return 1;
}
}
static int
is_valid_mbc_string(const UChar* p, const UChar* end)
{
@@ -135,15 +150,6 @@ gb18030_mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end,
pp, end, lower);
}
#if 0
static int
gb18030_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_GB18030, flag, pp, end);
}
#endif
static int
gb18030_is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
@@ -522,7 +528,7 @@ OnigEncodingType OnigEncodingGB18030 = {
1, /* min enc length */
onigenc_is_mbc_newline_0x0a,
gb18030_mbc_to_code,
onigenc_mb4_code_to_mbclen,
gb18030_code_to_mbclen,
gb18030_code_to_mbc,
gb18030_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
+1 -27
View File
@@ -2,7 +2,7 @@
iso8859_1.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -216,32 +216,6 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_1_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
if (*p >= 0xaa && *p <= 0xba)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -23
View File
@@ -2,7 +2,7 @@
iso8859_10.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,28 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_10_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -1
View File
@@ -2,7 +2,7 @@
iso8859_11.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -27
View File
@@ -2,7 +2,7 @@
iso8859_13.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,32 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_13_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xdf, 0xb5 are lower case letter, but can't convert. */
if (*p == 0xb5)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -24
View File
@@ -2,7 +2,7 @@
iso8859_14.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,29 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1; /* return byte length of converted char to lower */
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_14_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -27
View File
@@ -2,7 +2,7 @@
iso8859_15.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,32 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1; /* return byte length of converted char to lower */
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_15_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xdf etc.. are lower case letter, but can't convert. */
if (*p == 0xaa || *p == 0xb5 || *p == 0xba)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -23
View File
@@ -2,7 +2,7 @@
iso8859_16.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,28 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1; /* return byte length of converted char to lower */
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_16_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -23
View File
@@ -2,7 +2,7 @@
iso8859_2.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,28 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1; /* return byte length of converted char to lower */
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_2_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static const OnigPairCaseFoldCodes CaseFoldMap[] = {
{ 0xa1, 0xb1 },
{ 0xa3, 0xb3 },
+1 -27
View File
@@ -2,7 +2,7 @@
iso8859_3.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,32 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_3_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
if (*p == 0xb5)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -26
View File
@@ -2,7 +2,7 @@
iso8859_4.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,31 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1; /* return byte length of converted char to lower */
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_4_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
if (*p == 0xa2)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -14
View File
@@ -2,7 +2,7 @@
iso8859_5.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -114,19 +114,6 @@ mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
(*pp)++;
v = (EncISO_8859_5_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -1
View File
@@ -2,7 +2,7 @@
iso8859_6.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -21
View File
@@ -2,7 +2,7 @@
iso8859_7.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -114,26 +114,6 @@ mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
(*pp)++;
v = (EncISO_8859_7_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
if (*p == 0xc0 || *p == 0xe0)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -1
View File
@@ -2,7 +2,7 @@
iso8859_8.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -27
View File
@@ -2,7 +2,7 @@
iso8859_9.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -121,32 +121,6 @@ mbc_case_fold(OnigCaseFoldType flag,
return 1;
}
#if 0
static int
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
(*pp)++;
return TRUE;
}
(*pp)++;
v = (EncISO_8859_9_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
if ((v | BIT_CTYPE_LOWER) != 0) {
/* 0xdf etc.. are lower case letter, but can't convert. */
if (*p >= 0xaa && *p <= 0xba)
return FALSE;
else
return TRUE;
}
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -20
View File
@@ -2,7 +2,7 @@
koi8.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -115,25 +115,6 @@ koi8_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
return 1;
}
#if 0
static int
koi8_is_mbc_ambiguous(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end)
{
const OnigUChar* p = *pp;
(*pp)++;
if (((flag & ONIGENC_CASE_FOLD_ASCII_CASE) != 0 &&
ONIGENC_IS_MBC_ASCII(p)) ||
((flag & ONIGENC_CASE_FOLD_NONASCII_CASE) != 0 &&
!ONIGENC_IS_MBC_ASCII(p))) {
int v = (EncKOI8_CtypeTable[*p] &
(BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
return (v != 0 ? TRUE : FALSE);
}
return FALSE;
}
#endif
static int
koi8_is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -14
View File
@@ -2,7 +2,7 @@
koi8_r.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -114,19 +114,6 @@ koi8_r_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED,
return 1;
}
#if 0
static int
koi8_r_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
{
int v;
const UChar* p = *pp;
(*pp)++;
v = (EncKOI8_R_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
return (v != 0 ? TRUE : FALSE);
}
#endif
static int
koi8_r_is_code_ctype(OnigCodePoint code, unsigned int ctype)
{
+1 -1
View File
@@ -2,7 +2,7 @@
mktable.c
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -2,7 +2,7 @@
onig_init.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2016-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2016-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+1 -1
View File
@@ -4,7 +4,7 @@
oniggnu.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+5 -1
View File
@@ -4,7 +4,7 @@
onigposix.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -95,6 +95,7 @@ typedef struct {
#endif
#endif
#ifndef ONIG_STATIC
#ifndef ONIG_EXTERN
#if defined(_WIN32) && !defined(__GNUC__)
#if defined(ONIGURUMA_EXPORT)
@@ -108,6 +109,9 @@ typedef struct {
#ifndef ONIG_EXTERN
#define ONIG_EXTERN extern
#endif
#else
#define ONIG_EXTERN extern
#endif
#ifndef ONIGURUMA_H
typedef unsigned int OnigOptionType;
+31 -3
View File
@@ -4,7 +4,7 @@
oniguruma.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,9 +36,9 @@ extern "C" {
#define ONIGURUMA
#define ONIGURUMA_VERSION_MAJOR 6
#define ONIGURUMA_VERSION_MINOR 9
#define ONIGURUMA_VERSION_TEENY 3
#define ONIGURUMA_VERSION_TEENY 4
#define ONIGURUMA_VERSION_INT 60903
#define ONIGURUMA_VERSION_INT 60904
#ifndef P_
#if defined(__STDC__) || defined(_WIN32)
@@ -687,6 +687,14 @@ typedef OnigRegexType* OnigRegex;
typedef OnigRegexType regex_t;
#endif
struct OnigRegSetStruct;
typedef struct OnigRegSetStruct OnigRegSet;
typedef enum {
ONIG_REGSET_POSITION_LEAD = 0,
ONIG_REGSET_REGEX_LEAD = 1,
ONIG_REGSET_PRIORITY_TO_REGEX_ORDER = 2
} OnigRegSetLead;
typedef struct {
int num_of_elements;
@@ -797,6 +805,26 @@ ONIG_EXTERN
int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
ONIG_EXTERN
int onig_match_with_param P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option, OnigMatchParam* mp));
ONIG_EXTERN
int onig_regset_new P_((OnigRegSet** rset, int n, regex_t* regs[]));
ONIG_EXTERN
int onig_regset_add P_((OnigRegSet* set, regex_t* reg));
ONIG_EXTERN
int onig_regset_replace P_((OnigRegSet* set, int at, regex_t* reg));
ONIG_EXTERN
void onig_regset_free P_((OnigRegSet* set));
ONIG_EXTERN
int onig_regset_number_of_regex P_((OnigRegSet* set));
ONIG_EXTERN
regex_t* onig_regset_get_regex P_((OnigRegSet* set, int at));
ONIG_EXTERN
OnigRegion* onig_regset_get_region P_((OnigRegSet* set, int at));
ONIG_EXTERN
int onig_regset_search P_((OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos));
ONIG_EXTERN
int onig_regset_search_with_param P_((OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, OnigMatchParam* mps[], int* rmatch_pos));
ONIG_EXTERN
OnigRegion* onig_region_new P_((void));
ONIG_EXTERN
File diff suppressed because it is too large. Load diff
+3 -63
View File
@@ -2,7 +2,7 @@
regenc.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -182,7 +182,8 @@ onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc,
p += enclen(enc, p);
}
else {
if (prev) *prev = (const UChar* )NULL; /* Sorry */
if (prev)
*prev = onigenc_get_prev_char_head(enc, start, p);
}
return p;
}
@@ -208,20 +209,6 @@ onigenc_step_back(OnigEncoding enc, const UChar* start, const UChar* s, int n)
return (UChar* )s;
}
#if 0
extern int
onigenc_mbc_enc_len_end(OnigEncoding enc, const UChar* p, const UChar* end)
{
int len;
int n;
len = ONIGENC_MBC_ENC_LEN(enc, p);
n = (int )(end - p);
return (n < len ? n : len);
}
#endif
extern UChar*
onigenc_step(OnigEncoding enc, const UChar* p, const UChar* end, int n)
{
@@ -705,18 +692,6 @@ onigenc_ascii_mbc_case_fold(OnigCaseFoldType flag ARG_UNUSED, const UChar** p,
return 1; /* return byte length of converted char to lower */
}
#if 0
extern int
onigenc_ascii_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
const UChar* p = *pp;
(*pp)++;
return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
}
#endif
extern int
onigenc_single_byte_mbc_enc_len(const UChar* p ARG_UNUSED)
{
@@ -833,41 +808,6 @@ onigenc_mbn_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED,
}
}
#if 0
extern int
onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag,
const UChar** pp, const UChar* end)
{
const UChar* p = *pp;
if (ONIGENC_IS_MBC_ASCII(p)) {
(*pp)++;
return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
}
(*pp) += enclen(enc, p);
return FALSE;
}
#endif
extern int
onigenc_mb2_code_to_mbclen(OnigCodePoint code)
{
if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
if ((code & 0xff00) != 0) return 2;
else return 1;
}
extern int
onigenc_mb4_code_to_mbclen(OnigCodePoint code)
{
if ((code & 0xff000000) != 0) return 4;
else if ((code & 0xff0000) != 0) return 3;
else if ((code & 0xff00) != 0) return 2;
else return 1;
}
extern int
onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
{
+1 -3
View File
@@ -4,7 +4,7 @@
regenc.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -163,13 +163,11 @@ extern int onigenc_length_check_is_valid_mbc_string P_((OnigEncoding enc, const
/* methods for multi byte encoding */
extern OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
extern int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
extern int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code));
extern int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
extern int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
extern int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
extern int onigenc_is_mbc_word_ascii P_((OnigEncoding enc, UChar* s, const UChar* end));
extern int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
extern int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code));
extern int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
extern int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
extern struct PropertyNameCtype* onigenc_euc_jp_lookup_property_name P_((register const char *str, register size_t len));
+1 -1
View File
@@ -2,7 +2,7 @@
regerror.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
File diff suppressed because it is too large. Load diff
+1 -3
View File
@@ -2,7 +2,7 @@
regext.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,6 @@ conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
}
}
#if 0
static void
conv_ext0le32(const UChar* s, const UChar* end, UChar* conv)
{
@@ -92,7 +91,6 @@ conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv)
s += 2;
}
}
#endif
static int
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
+1 -1
View File
@@ -2,7 +2,7 @@
reggnu.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
+138 -224
View File
@@ -4,7 +4,7 @@
regint.h - Oniguruma (regular expression library)
**********************************************************************/
/*-
* Copyright (c) 2002-2019 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* Copyright (c) 2002-2019 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,16 +47,11 @@
#endif
#endif
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
(defined(__ppc__) && defined(__APPLE__)) || \
defined(__x86_64) || defined(__x86_64__) || \
defined(__mc68020__)
#define PLATFORM_UNALIGNED_WORD_ACCESS
#endif
#ifndef ONIG_DISABLE_DIRECT_THREADING
#ifdef __GNUC__
#define USE_GOTO_LABELS_AS_VALUES
#endif
#endif
/* config */
/* spec. config */
@@ -82,6 +77,8 @@
#define USE_VARIABLE_META_CHARS
#define USE_POSIX_API_REGION_OPTION
#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
/* #define USE_REPEAT_AND_EMPTY_CHECK_LOCAL_VAR */
#include "regenc.h"
@@ -197,49 +194,16 @@ typedef unsigned int uintptr_t;
#define CHAR_MAP_SIZE 256
#define INFINITE_LEN ONIG_INFINITE_DISTANCE
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
#define PLATFORM_GET_INC(val,p,type) do{\
val = *(type* )p;\
(p) += sizeof(type);\
} while(0)
#else
#define PLATFORM_GET_INC(val,p,type) do{\
xmemcpy(&val, (p), sizeof(type));\
(p) += sizeof(type);\
} while(0)
/* sizeof(OnigCodePoint) */
#ifdef SIZEOF_SIZE_T
# define WORD_ALIGNMENT_SIZE SIZEOF_SIZE_T
#else
# define WORD_ALIGNMENT_SIZE SIZEOF_LONG
#endif
#define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
(pad_size) = WORD_ALIGNMENT_SIZE - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
} while (0)
#define ALIGNMENT_RIGHT(addr) do {\
(addr) += (WORD_ALIGNMENT_SIZE - 1);\
(addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
} while (0)
#endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
#ifdef USE_CALLOUT
typedef struct {
int flag;
OnigCalloutOf of;
int in;
int name_id;
const UChar* tag_start;
const UChar* tag_end;
int flag;
OnigCalloutOf of;
int in;
int name_id;
const UChar* tag_start;
const UChar* tag_end;
OnigCalloutType type;
OnigCalloutFunc start_func;
OnigCalloutFunc end_func;
@@ -272,7 +236,6 @@ enum OptimizeType {
OPTIMIZE_STR, /* Slow Search */
OPTIMIZE_STR_FAST, /* Sunday quick search / BMH */
OPTIMIZE_STR_FAST_STEP_FORWARD, /* Sunday quick search / BMH */
OPTIMIZE_STR_CASE_FOLD_FAST, /* Sunday quick search / BMH (ignore case) */
OPTIMIZE_STR_CASE_FOLD, /* Slow Search (ignore case) */
OPTIMIZE_MAP /* char map */
};
@@ -288,6 +251,8 @@ typedef unsigned int MemStatusType;
#define MEM_STATUS_AT0(stats,n) \
((n) > 0 && (n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : ((stats) & 1))
#define MEM_STATUS_IS_ALL_ON(stats) (((stats) & 1) != 0)
#define MEM_STATUS_ON(stats,n) do {\
if ((n) < (int )MEM_STATUS_BITS_NUM) {\
if ((n) != 0)\
@@ -302,8 +267,14 @@ typedef unsigned int MemStatusType;
(stats) |= ((MemStatusType )1 << (n));\
} while (0)
#define MEM_STATUS_LIMIT_AT(stats,n) \
((n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : 0)
#define MEM_STATUS_LIMIT_ON(stats,n) do {\
if ((n) < (int )MEM_STATUS_BITS_NUM && (n) != 0) {\
(stats) |= ((MemStatusType )1 << (n));\
}\
} while (0)
#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
#define IS_CODE_WORD_ASCII(enc,code) \
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
@@ -354,16 +325,12 @@ typedef unsigned int MemStatusType;
/* bitset */
#define BITS_PER_BYTE 8
#define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
#define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE)
#define BITS_IN_ROOM 32 /* 4 * BITS_PER_BYTE */
#define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
typedef unsigned int Bits;
#else
typedef unsigned char Bits;
#endif
typedef Bits BitSet[BITSET_SIZE];
typedef Bits* BitSetRef;
typedef uint32_t Bits;
typedef Bits BitSet[BITSET_SIZE];
typedef Bits* BitSetRef;
#define SIZE_BITSET sizeof(BitSet)
@@ -372,8 +339,8 @@ typedef Bits* BitSetRef;
for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
} while (0)
#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
#define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM))
#define BS_ROOM(bs,pos) (bs)[(unsigned int )(pos) >> 5]
#define BS_BIT(pos) (1u << ((unsigned int )(pos) & 0x1f))
#define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
#define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
@@ -389,11 +356,13 @@ typedef struct _BBuf {
#define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size))
/*
#define BB_SIZE_INC(buf,inc) do{\
(buf)->alloc += (inc);\
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
} while (0)
*/
#define BB_EXPAND(buf,low) do{\
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
@@ -491,39 +460,34 @@ typedef struct _BBuf {
/* operation code */
enum OpCode {
OP_FINISH = 0, /* matching process terminator (no more alternative) */
OP_END = 1, /* pattern code terminator (success end) */
OP_EXACT1 = 2, /* single byte, N = 1 */
OP_EXACT2, /* single byte, N = 2 */
OP_EXACT3, /* single byte, N = 3 */
OP_EXACT4, /* single byte, N = 4 */
OP_EXACT5, /* single byte, N = 5 */
OP_EXACTN, /* single byte */
OP_EXACTMB2N1, /* mb-length = 2 N = 1 */
OP_EXACTMB2N2, /* mb-length = 2 N = 2 */
OP_EXACTMB2N3, /* mb-length = 2 N = 3 */
OP_EXACTMB2N, /* mb-length = 2 */
OP_EXACTMB3N, /* mb-length = 3 */
OP_EXACTMBN, /* other length */
OP_EXACT1_IC, /* single byte, N = 1, ignore case */
OP_EXACTN_IC, /* single byte, ignore case */
OP_FINISH = 0, /* matching process terminator (no more alternative) */
OP_END = 1, /* pattern code terminator (success end) */
OP_STR_1 = 2, /* single byte, N = 1 */
OP_STR_2, /* single byte, N = 2 */
OP_STR_3, /* single byte, N = 3 */
OP_STR_4, /* single byte, N = 4 */
OP_STR_5, /* single byte, N = 5 */
OP_STR_N, /* single byte */
OP_STR_MB2N1, /* mb-length = 2 N = 1 */
OP_STR_MB2N2, /* mb-length = 2 N = 2 */
OP_STR_MB2N3, /* mb-length = 2 N = 3 */
OP_STR_MB2N, /* mb-length = 2 */
OP_STR_MB3N, /* mb-length = 3 */
OP_STR_MBN, /* other length */
OP_STR_1_IC, /* single byte, N = 1, ignore case */
OP_STR_N_IC, /* single byte, ignore case */
OP_CCLASS,
OP_CCLASS_MB,
OP_CCLASS_MIX,
OP_CCLASS_NOT,
OP_CCLASS_MB_NOT,
OP_CCLASS_MIX_NOT,
OP_ANYCHAR, /* "." */
OP_ANYCHAR_ML, /* "." multi-line */
OP_ANYCHAR_STAR, /* ".*" */
OP_ANYCHAR_ML_STAR, /* ".*" multi-line */
OP_ANYCHAR_STAR_PEEK_NEXT,
OP_ANYCHAR_ML_STAR_PEEK_NEXT,
OP_WORD,
OP_WORD_ASCII,
OP_NO_WORD,
@@ -532,16 +496,13 @@ enum OpCode {
OP_NO_WORD_BOUNDARY,
OP_WORD_BEGIN,
OP_WORD_END,
OP_TEXT_SEGMENT_BOUNDARY,
OP_BEGIN_BUF,
OP_END_BUF,
OP_BEGIN_LINE,
OP_END_LINE,
OP_SEMI_END_BUF,
OP_BEGIN_POSITION,
OP_BACKREF1,
OP_BACKREF2,
OP_BACKREF_N,
@@ -552,34 +513,35 @@ enum OpCode {
OP_BACKREF_WITH_LEVEL_IC, /* \k<xxx+n>, \k<xxx-n> */
OP_BACKREF_CHECK, /* (?(n)), (?('name')) */
OP_BACKREF_CHECK_WITH_LEVEL, /* (?(n-level)), (?('name-level')) */
OP_MEMORY_START,
OP_MEMORY_START_PUSH, /* push back-tracker to stack */
OP_MEMORY_END_PUSH, /* push back-tracker to stack */
OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */
OP_MEMORY_END,
OP_MEMORY_END_REC, /* push marker to stack */
OP_MEM_START,
OP_MEM_START_PUSH, /* push back-tracker to stack */
OP_MEM_END_PUSH, /* push back-tracker to stack */
#ifdef USE_CALL
OP_MEM_END_PUSH_REC, /* push back-tracker to stack */
#endif
OP_MEM_END,
#ifdef USE_CALL
OP_MEM_END_REC, /* push marker to stack */
#endif
OP_FAIL, /* pop stack and move */
OP_JUMP,
OP_PUSH,
OP_PUSH_SUPER,
OP_POP_OUT,
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
#endif
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
OP_REPEAT, /* {n,m} */
OP_REPEAT_NG, /* {n,m}? (non greedy) */
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
OP_REPEAT, /* {n,m} */
OP_REPEAT_NG, /* {n,m}? (non greedy) */
OP_REPEAT_INC,
OP_REPEAT_INC_NG, /* non greedy */
OP_REPEAT_INC_SG, /* search and get in stack */
OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
OP_REPEAT_INC_NG, /* non greedy */
OP_EMPTY_CHECK_START, /* null loop checker start */
OP_EMPTY_CHECK_END, /* null loop checker end */
OP_EMPTY_CHECK_END_MEMST, /* null loop checker end (with capture status) */
#ifdef USE_CALL
OP_EMPTY_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
#endif
OP_PREC_READ_START, /* (?=...) start */
OP_PREC_READ_END, /* (?=...) end */
OP_PREC_READ_NOT_START, /* (?!...) start */
@@ -589,11 +551,12 @@ enum OpCode {
OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
OP_LOOK_BEHIND_NOT_START, /* (?<!...) start */
OP_LOOK_BEHIND_NOT_END, /* (?<!...) end */
OP_CALL, /* \g<name> */
OP_RETURN,
OP_PUSH_SAVE_VAL,
OP_UPDATE_VAR,
#ifdef USE_CALL
OP_CALL, /* \g<name> */
OP_RETURN,
#endif
#ifdef USE_CALLOUT
OP_CALLOUT_CONTENTS, /* (?{...}) (?{{...}}) */
OP_CALLOUT_NAME, /* (*name) (*name[tag](args...)) */
@@ -601,8 +564,8 @@ enum OpCode {
};
enum SaveType {
SAVE_KEEP = 0, /* SAVE S */
SAVE_S = 1,
SAVE_KEEP = 0, /* SAVE S */
SAVE_S = 1,
SAVE_RIGHT_RANGE = 2,
};
@@ -642,116 +605,57 @@ typedef int ModeType;
#define SIZE_UPDATE_VAR_TYPE sizeof(UpdateVarType)
#define SIZE_MODE sizeof(ModeType)
#define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
#define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
#define GET_LENGTH_INC(len,p) PLATFORM_GET_INC(len, p, LengthType)
#define GET_MEMNUM_INC(num,p) PLATFORM_GET_INC(num, p, MemNumType)
#define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
#define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
#define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
#define GET_SAVE_TYPE_INC(type,p) PLATFORM_GET_INC(type, p, SaveType)
#define GET_UPDATE_VAR_TYPE_INC(type,p) PLATFORM_GET_INC(type, p, UpdateVarType)
#define GET_MODE_INC(mode,p) PLATFORM_GET_INC(mode, p, ModeType)
/* code point's address must be aligned address. */
#define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
#define GET_BYTE_INC(byte,p) do{\
byte = *(p);\
(p)++;\
} while(0)
/* op-code + arg size */
#if 0
#define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PUSH_SUPER (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_POP_OUT SIZE_OPCODE
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_WORD_BOUNDARY (SIZE_OPCODE + SIZE_MODE)
#define SIZE_OP_PREC_READ_START SIZE_OPCODE
#define SIZE_OP_PREC_READ_NOT_START (SIZE_OPCODE + SIZE_RELADDR)
#define SIZE_OP_PREC_READ_END SIZE_OPCODE
#define SIZE_OP_PREC_READ_NOT_END SIZE_OPCODE
#define SIZE_OP_FAIL SIZE_OPCODE
#define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_ATOMIC_START SIZE_OPCODE
#define SIZE_OP_ATOMIC_END SIZE_OPCODE
#define SIZE_OP_EMPTY_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_EMPTY_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
#define SIZE_OP_LOOK_BEHIND_NOT_START (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
#define SIZE_OP_LOOK_BEHIND_NOT_END SIZE_OPCODE
#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
#define SIZE_OP_RETURN SIZE_OPCODE
#define SIZE_OP_PUSH_SAVE_VAL (SIZE_OPCODE + SIZE_SAVE_TYPE + SIZE_MEMNUM)
#define SIZE_OP_UPDATE_VAR (SIZE_OPCODE + SIZE_UPDATE_VAR_TYPE + SIZE_MEMNUM)
#ifdef USE_CALLOUT
#define SIZE_OP_CALLOUT_CONTENTS (SIZE_OPCODE + SIZE_MEMNUM)
#define SIZE_OP_CALLOUT_NAME (SIZE_OPCODE + SIZE_MEMNUM + SIZE_MEMNUM)
#endif
#else /* if 0 */
/* for relative address increment to go next op. */
#define SIZE_INC_OP 1
#define SIZE_INC 1
#define SIZE_OP_ANYCHAR_STAR 1
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT 1
#define SIZE_OP_JUMP 1
#define SIZE_OP_PUSH 1
#define SIZE_OP_PUSH_SUPER 1
#define SIZE_OP_POP_OUT 1
#define OPSIZE_ANYCHAR_STAR 1
#define OPSIZE_ANYCHAR_STAR_PEEK_NEXT 1
#define OPSIZE_JUMP 1
#define OPSIZE_PUSH 1
#define OPSIZE_PUSH_SUPER 1
#define OPSIZE_POP_OUT 1
#ifdef USE_OP_PUSH_OR_JUMP_EXACT
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 1
#define OPSIZE_PUSH_OR_JUMP_EXACT1 1
#endif
#define SIZE_OP_PUSH_IF_PEEK_NEXT 1
#define SIZE_OP_REPEAT 1
#define SIZE_OP_REPEAT_INC 1
#define SIZE_OP_REPEAT_INC_NG 1
#define SIZE_OP_WORD_BOUNDARY 1
#define SIZE_OP_PREC_READ_START 1
#define SIZE_OP_PREC_READ_NOT_START 1
#define SIZE_OP_PREC_READ_END 1
#define SIZE_OP_PREC_READ_NOT_END 1
#define SIZE_OP_BACKREF 1
#define SIZE_OP_FAIL 1
#define SIZE_OP_MEMORY_START 1
#define SIZE_OP_MEMORY_START_PUSH 1
#define SIZE_OP_MEMORY_END_PUSH 1
#define SIZE_OP_MEMORY_END_PUSH_REC 1
#define SIZE_OP_MEMORY_END 1
#define SIZE_OP_MEMORY_END_REC 1
#define SIZE_OP_ATOMIC_START 1
#define SIZE_OP_ATOMIC_END 1
#define SIZE_OP_EMPTY_CHECK_START 1
#define SIZE_OP_EMPTY_CHECK_END 1
#define SIZE_OP_LOOK_BEHIND 1
#define SIZE_OP_LOOK_BEHIND_NOT_START 1
#define SIZE_OP_LOOK_BEHIND_NOT_END 1
#define SIZE_OP_CALL 1
#define SIZE_OP_RETURN 1
#define SIZE_OP_PUSH_SAVE_VAL 1
#define SIZE_OP_UPDATE_VAR 1
#define OPSIZE_PUSH_IF_PEEK_NEXT 1
#define OPSIZE_REPEAT 1
#define OPSIZE_REPEAT_INC 1
#define OPSIZE_REPEAT_INC_NG 1
#define OPSIZE_WORD_BOUNDARY 1
#define OPSIZE_PREC_READ_START 1
#define OPSIZE_PREC_READ_NOT_START 1
#define OPSIZE_PREC_READ_END 1
#define OPSIZE_PREC_READ_NOT_END 1
#define OPSIZE_BACKREF 1
#define OPSIZE_FAIL 1
#define OPSIZE_MEM_START 1
#define OPSIZE_MEM_START_PUSH 1
#define OPSIZE_MEM_END_PUSH 1
#define OPSIZE_MEM_END_PUSH_REC 1
#define OPSIZE_MEM_END 1
#define OPSIZE_MEM_END_REC 1
#define OPSIZE_ATOMIC_START 1
#define OPSIZE_ATOMIC_END 1
#define OPSIZE_EMPTY_CHECK_START 1
#define OPSIZE_EMPTY_CHECK_END 1
#define OPSIZE_LOOK_BEHIND 1
#define OPSIZE_LOOK_BEHIND_NOT_START 1
#define OPSIZE_LOOK_BEHIND_NOT_END 1
#define OPSIZE_CALL 1
#define OPSIZE_RETURN 1
#define OPSIZE_PUSH_SAVE_VAL 1
#define OPSIZE_UPDATE_VAR 1
#ifdef USE_CALLOUT
#define SIZE_OP_CALLOUT_CONTENTS 1
#define SIZE_OP_CALLOUT_NAME 1
#define OPSIZE_CALLOUT_CONTENTS 1
#define OPSIZE_CALLOUT_NAME 1
#endif
#endif /* if 0 */
#define MC_ESC(syn) (syn)->meta_char_table.esc
@@ -882,7 +786,7 @@ typedef struct {
} repeat; /* REPEAT, REPEAT_NG */
struct {
MemNumType id;
} repeat_inc; /* REPEAT_INC, REPEAT_INC_SG, REPEAT_INC_NG, REPEAT_INC_NG_SG */
} repeat_inc; /* REPEAT_INC, REPEAT_INC_NG */
struct {
MemNumType mem;
} empty_check_start;
@@ -933,48 +837,58 @@ typedef struct {
#endif
} RegexExt;
typedef struct {
int lower;
int upper;
union {
Operation* pcode; /* address of repeated body */
int offset;
} u;
} RepeatRange;
struct re_pattern_buffer {
/* common members of BBuf(bytes-buffer) */
Operation* ops;
#ifdef USE_DIRECT_THREADED_CODE
enum OpCode* ocs;
#endif
Operation* ops_curr;
unsigned int ops_used; /* used space for ops */
unsigned int ops_alloc; /* allocated space for ops */
Operation* ops_curr;
unsigned int ops_used; /* used space for ops */
unsigned int ops_alloc; /* allocated space for ops */
unsigned char* string_pool;
unsigned char* string_pool_end;
int num_mem; /* used memory(...) num counted from 1 */
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
int num_null_check; /* OP_EMPTY_CHECK_START/END id counter */
int num_call; /* number of subexp call */
unsigned int capture_history; /* (?@...) flag (1-31) */
unsigned int bt_mem_start; /* need backtrack flag */
unsigned int bt_mem_end; /* need backtrack flag */
int stack_pop_level;
int repeat_range_alloc;
OnigRepeatRange* repeat_range;
int num_mem; /* used memory(...) num counted from 1 */
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
int num_empty_check; /* OP_EMPTY_CHECK_START/END id counter */
int num_call; /* number of subexp call */
MemStatusType capture_history; /* (?@...) flag (1-31) */
MemStatusType push_mem_start; /* need backtrack flag */
MemStatusType push_mem_end; /* need backtrack flag */
MemStatusType empty_status_mem;
int stack_pop_level;
int repeat_range_alloc;
RepeatRange* repeat_range;
OnigEncoding enc;
OnigOptionType options;
OnigSyntaxType* syntax;
OnigCaseFoldType case_fold_flag;
void* name_table;
OnigEncoding enc;
OnigOptionType options;
OnigSyntaxType* syntax;
OnigCaseFoldType case_fold_flag;
void* name_table;
/* optimization info (string search, char-map and anchors) */
int optimize; /* optimize flag */
int threshold_len; /* search str-length for apply optimize */
int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
OnigLen anchor_dmin; /* (SEMI_)END_BUF anchor distance */
OnigLen anchor_dmax; /* (SEMI_)END_BUF anchor distance */
OnigLen anc_dist_min; /* (SEMI_)END_BUF anchor distance */
OnigLen anc_dist_max; /* (SEMI_)END_BUF anchor distance */
int sub_anchor; /* start-anchor for exact or map */
unsigned char *exact;
unsigned char *exact_end;
unsigned char map[CHAR_MAP_SIZE]; /* used as BMH skip or char-map */
int map_offset;
OnigLen dmin; /* min-distance of exact or map */
OnigLen dmax; /* max-distance of exact or map */
OnigLen dist_min; /* min-distance of exact or map */
OnigLen dist_max; /* max-distance of exact or map */
RegexExt* extp;
};
File diff suppressed because it is too large. Load diff
Loaded 100 of 165 files, more files were not shown because too many files have changed in this diff. Show more