mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-26 10:25:41 +00:00
Compare commits
132
Commits
PHP-5.6.12
...
php-5.5.35
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d10b01092 | ||
|
|
633bb5ccb4 | ||
|
|
61c7a06e7c | ||
|
|
dccda88f27 | ||
|
|
f856734c67 | ||
|
|
082aecfc3a | ||
|
|
d650063a04 | ||
|
|
fd9689745c | ||
|
|
b15f0ecc0f | ||
|
|
8a4d164c2b | ||
|
|
4b0b1cec00 | ||
|
|
f0120ff878 | ||
|
|
551423c642 | ||
|
|
fe13566c93 | ||
|
|
9c19a08b9d | ||
|
|
3dd82caf57 | ||
|
|
f8dd10508b | ||
|
|
64f42c73ef | ||
|
|
95433e8e33 | ||
|
|
72281f29dd | ||
|
|
914d33c40e | ||
|
|
3c8ccdd9d3 | ||
|
|
54df59b729 | ||
|
|
153a44d6bb | ||
|
|
a6fdc5bb27 | ||
|
|
b1bd4119bc | ||
|
|
377d353c9f | ||
|
|
7d875fb9df | ||
|
|
2a7d8c0a06 | ||
|
|
e7051cb47a | ||
|
|
0d86a98c31 | ||
|
|
b5ef8ed168 | ||
|
|
ca02d9c2d6 | ||
|
|
07c7df68bd | ||
|
|
a1c675e3f2 | ||
|
|
686a17893a | ||
|
|
f4d7bbf4ac | ||
|
|
828364e59c | ||
|
|
df78eacc2f | ||
|
|
54c210d2ea | ||
|
|
6297a117d7 | ||
|
|
1c1b8b6998 | ||
|
|
285cd3417f | ||
|
|
635ba1f2c3 | ||
|
|
13ad4d3e97 | ||
|
|
aa8d3a8cc6 | ||
|
|
a6734f70e1 | ||
|
|
74dcbe1299 | ||
|
|
2baeb167a0 | ||
|
|
dcf3c9761c | ||
|
|
1785d2b805 | ||
|
|
4df84a648e | ||
|
|
be19dbcb84 | ||
|
|
4bb422343f | ||
|
|
2e157c5275 | ||
|
|
f3838a9c35 | ||
|
|
d7fb43e30d | ||
|
|
3f08fc0466 | ||
|
|
932f707177 | ||
|
|
1ddf72180a | ||
|
|
f98ab19dc0 | ||
|
|
e78ac461db | ||
|
|
d698f0ae51 | ||
|
|
bb98ed600a | ||
|
|
a12cef979d | ||
|
|
ea807f9c07 | ||
|
|
51fca4b77d | ||
|
|
43c2dfa7b3 | ||
|
|
4aeff30337 | ||
|
|
1922c650ba | ||
|
|
32fe02c27d | ||
|
|
31b634bf7c | ||
|
|
0fac73a3bf | ||
|
|
7ceb0e3a18 | ||
|
|
53d274beb0 | ||
|
|
33d3acaae7 | ||
|
|
48cfd1160b | ||
|
|
7c31203935 | ||
|
|
e2291e4b1a | ||
|
|
1390a5812b | ||
|
|
3605d1baf5 | ||
|
|
906f19f136 | ||
|
|
6935058a98 | ||
|
|
c8f07ad477 | ||
|
|
259057b2a4 | ||
|
|
f06a069c46 | ||
|
|
e8429400d4 | ||
|
|
e201f01ac1 | ||
|
|
f9c2bf73ad | ||
|
|
ce2c67c8e8 | ||
|
|
03964892c0 | ||
|
|
64043cb9e5 | ||
|
|
fc8eff897b | ||
|
|
24dda816d0 | ||
|
|
95a0b11d0a | ||
|
|
e93d7953df | ||
|
|
941bbf2067 | ||
|
|
df4bf28f9f | ||
|
|
85d34c3264 | ||
|
|
1744be2d17 | ||
|
|
9ff3334397 | ||
|
|
dc72378ff0 | ||
|
|
15e9f4baf4 | ||
|
|
b221df5549 | ||
|
|
2425f88afd | ||
|
|
da5321013c | ||
|
|
f2f8ea9ac5 | ||
|
|
f1acac154a | ||
|
|
d52c485717 | ||
|
|
742c54aecf | ||
|
|
0a21b5d970 | ||
|
|
ee61c7175f | ||
|
|
69ed3969dd | ||
|
|
51f9a00b47 | ||
|
|
dda81f0505 | ||
|
|
0e09009753 | ||
|
|
4d2278143a | ||
|
|
863bf294fe | ||
|
|
7381b6accc | ||
|
|
c7d3c027d5 | ||
|
|
c2e197e4ef | ||
|
|
7fc04937f5 | ||
|
|
66edc15875 | ||
|
|
8f1baa6e1c | ||
|
|
ce5c4500cd | ||
|
|
16023f3e3b | ||
|
|
7a4584d3f6 | ||
|
|
b7fa67742c | ||
|
|
e488690d95 | ||
|
|
c96d08b272 | ||
|
|
daa0abaf77 | ||
|
|
496f291f3d |
No files matched your search
@@ -20,6 +20,9 @@
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.xz
|
||||
*.tar.gz.asc
|
||||
*.tar.bz2.asc
|
||||
*.tar.xz.asc
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
|
||||
+13
-6
@@ -1,9 +1,21 @@
|
||||
language: c
|
||||
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- locales
|
||||
- language-pack-de
|
||||
- re2c
|
||||
- libgmp-dev
|
||||
- libicu-dev
|
||||
- libmcrypt-dev
|
||||
- libtidy-dev
|
||||
notifications:
|
||||
email:
|
||||
on_failure: change
|
||||
irc:
|
||||
template:
|
||||
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} - Change view : %{compare_url} - Build details : %{build_url}"
|
||||
channels:
|
||||
- "irc.efnet.org#php.pecl"
|
||||
on_success: change
|
||||
@@ -25,11 +37,6 @@ env:
|
||||
- ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
|
||||
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
|
||||
|
||||
before_install:
|
||||
- sudo cp ./travis/de /var/lib/locales/supported.d/de
|
||||
- sudo dpkg-reconfigure locales
|
||||
- ./travis/install.sh
|
||||
|
||||
before_script:
|
||||
# Compile PHP
|
||||
- ./travis/compile.sh
|
||||
|
||||
@@ -1,8 +1,174 @@
|
||||
PHP NEWS
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2015, PHP 5.5.28
|
||||
28 Apr 2016, PHP 5.5.35
|
||||
|
||||
** PHP 5.5 is in security-only mode , please do not commit to this branch **
|
||||
- BCMath:
|
||||
. Fix bug #72093 (bcpowmod accepts negative scale and corrupts _one_
|
||||
definition). (Stas)
|
||||
|
||||
- Exif:
|
||||
. Fix bug #72094 (Out of bounds heap read access in exif header
|
||||
processing). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fix bug #71912 (libgd: signedness vulnerability). (Stas)
|
||||
|
||||
- Intl:
|
||||
. Fix bug #72061 (Out-of-bounds reads in zif_grapheme_stripos with negative
|
||||
offset). (Stas)
|
||||
|
||||
- XML:
|
||||
. Fix bug #72099 (xml_parse_into_struct segmentation fault). (Stas)
|
||||
|
||||
31 Mar 2016, PHP 5.5.34
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
|
||||
file). (Anatol)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
|
||||
mbfl_strcut). (Stas)
|
||||
|
||||
- ODBC
|
||||
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
|
||||
name). (Stas)
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
|
||||
(andrew at jmpesp dot org)
|
||||
|
||||
- Standard
|
||||
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode).
|
||||
(taoguangchen at icloud dot com, Stas)
|
||||
|
||||
03 Mar 2016, PHP 5.5.33
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71498 (Out-of-Bound Read in phar_parse_zipfile()). (Stas)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize). (Stas)
|
||||
|
||||
04 Feb 2016, PHP 5.5.32
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71039 (exec functions ignore length but look for NULL termination).
|
||||
(Anatol)
|
||||
. Fixed bug #71323 (Output of stream_get_meta_data can be falsified by its
|
||||
input). (Leo Gaspard)
|
||||
. Fixed bug #71459 (Integer overflow in iptcembed()). (Stas)
|
||||
|
||||
- GD:
|
||||
. Improved the fix for bug #70976. (Remi)
|
||||
|
||||
- PCRE:
|
||||
. Upgraded pcrelib to 8.38.
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (Stas)
|
||||
. Fixed bug #71391 (NULL Pointer Dereference in phar_tar_setupmetadata()).
|
||||
(Stas)
|
||||
. Fixed bug #71488 (Stack overflow when decompressing tar archives). (Stas)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #71335 (Type Confusion in WDDX Packet Deserialization). (Stas)
|
||||
|
||||
07 Jan 2015, PHP 5.5.31
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #70755 (fpm_log.c memory leak and buffer overflow). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
|
||||
Out of Bounds). (emmanuel dot law at gmail dot com).
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
|
||||
(taoguangchen at icloud dot com)
|
||||
. Fixed bug #70741 (Session WDDX Packet Deserialization Type Confusion
|
||||
Vulnerability). (taoguangchen at icloud dot com)
|
||||
|
||||
- XMLRPC:
|
||||
. Fixed bug #70728 (Type Confusion Vulnerability in PHP_to_XMLRPC_worker()).
|
||||
(Julien)
|
||||
|
||||
01 Oct 2015, PHP 5.5.30
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
|
||||
. Fixed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
|
||||
entry filename is "/"). (Stas)
|
||||
|
||||
03 Sep 2015, PHP 5.5.29
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
|
||||
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
|
||||
(taoguangchen at icloud dot com)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte
|
||||
value of 32 bytes). (Stas)
|
||||
|
||||
- hash:
|
||||
. Fixed bug #70312 (HAVAL gives wrong hashes in specific cases). (letsgolee
|
||||
at naver dot com)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #70345 (Multiple vulnerabilities related to PCRE functions).
|
||||
(Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
|
||||
(Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
- XSLT:
|
||||
. Fixed bug #69782 (NULL pointer dereference). (Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
|
||||
creating directories). (neal at fb dot com)
|
||||
|
||||
06 Aug 2015, PHP 5.5.28
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69793 (Remotely triggerable stack exhaustion via recursive
|
||||
method calls). (Stas)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #70002 (TS issues with temporary dir handling). (Anatol)
|
||||
. Fixed bug #70121 (unserialize() could lead to unexpected methods execution
|
||||
/ NULL pointer deref). (Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Improved fix for bug #69441. (Anatol Belski)
|
||||
. Fixed bug #70019 (Files extracted from archive may be placed outside of
|
||||
destination directory). (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
multiple type confusions). (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
9 Jul 2015, PHP 5.5.27
|
||||
|
||||
@@ -46,9 +212,10 @@
|
||||
(Matteo)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file). (Stas)
|
||||
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file).
|
||||
(CVE-2015-5589) (Stas)
|
||||
. Fixed bug #69923 (Buffer overflow and stack smashing error in
|
||||
phar_fix_filepath). (Stas)
|
||||
phar_fix_filepath). (CVE-2015-5590) (Stas)
|
||||
|
||||
- SimpleXML:
|
||||
. Refactored the fix for bug #66084 (simplexml_load_string() mangles empty
|
||||
@@ -320,7 +487,8 @@
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69085 (SoapClient's __call() type confusion through
|
||||
unserialize()). (andrea dot palazzo at truel dot it, Laruence)
|
||||
unserialize()). (CVE-2015-4147, CVE-2015-4148)
|
||||
(andrea dot palazzo at truel dot it, Laruence)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #69108 ("Segmentation fault" when (de)serializing
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
|
||||
some basic rules with regards to Git usage will::
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
Git itself.
|
||||
PHP itself.
|
||||
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
|
||||
@@ -48,11 +48,11 @@ Currently we have the following branches in use::
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
@@ -67,7 +67,7 @@ Currently we have the following branches in use::
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.4) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.6) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
|
||||
--FILE--
|
||||
<?php
|
||||
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
+37
-8
@@ -41,7 +41,7 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot set non exception as previous exception");
|
||||
return;
|
||||
}
|
||||
@@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto Exception::__wakeup()
|
||||
Exception unserialize checks */
|
||||
#define CHECK_EXC_TYPE(name, type) \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
|
||||
if(value && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
|
||||
zval_ptr_dtor(&tmp); \
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __wakeup)
|
||||
{
|
||||
zval *value;
|
||||
zval *object = getThis();
|
||||
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
|
||||
CHECK_EXC_TYPE("message", IS_STRING);
|
||||
CHECK_EXC_TYPE("string", IS_STRING);
|
||||
CHECK_EXC_TYPE("code", IS_LONG);
|
||||
CHECK_EXC_TYPE("file", IS_STRING);
|
||||
CHECK_EXC_TYPE("line", IS_LONG);
|
||||
CHECK_EXC_TYPE("trace", IS_ARRAY);
|
||||
CHECK_EXC_TYPE("previous", IS_OBJECT);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
|
||||
ErrorException constructor */
|
||||
ZEND_METHOD(error_exception, __construct)
|
||||
@@ -586,7 +613,7 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
@@ -602,8 +629,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -640,15 +667,15 @@ ZEND_METHOD(exception, __toString)
|
||||
int len = 0;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
str = estrndup("", 0);
|
||||
|
||||
exception = getThis();
|
||||
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
|
||||
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
|
||||
prev_str = str;
|
||||
_default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
|
||||
_default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
|
||||
@@ -658,6 +685,7 @@ ZEND_METHOD(exception, __toString)
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
|
||||
trace = NULL;
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(exception)->function_table;
|
||||
fci.function_name = &fname;
|
||||
@@ -670,7 +698,7 @@ ZEND_METHOD(exception, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_P(trace) != IS_STRING) {
|
||||
if (trace && Z_TYPE_P(trace) != IS_STRING) {
|
||||
zval_ptr_dtor(&trace);
|
||||
trace = NULL;
|
||||
}
|
||||
@@ -727,6 +755,7 @@ ZEND_END_ARG_INFO()
|
||||
const static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=5
|
||||
PHP_RELEASE_VERSION=28
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=35
|
||||
PHP_EXTRA_VERSION=""
|
||||
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`
|
||||
|
||||
|
||||
+41
-19
@@ -201,6 +201,21 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ split_bc_num
|
||||
Convert to bc_num detecting scale */
|
||||
static bc_num split_bc_num(bc_num num) {
|
||||
bc_num newnum;
|
||||
if (num->n_refs >= 1) {
|
||||
return num;
|
||||
}
|
||||
newnum = _bc_new_num_ex(0, 0, 0);
|
||||
*newnum = *num;
|
||||
newnum->n_refs = 1;
|
||||
num->n_refs--;
|
||||
return newnum;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
|
||||
Returns the sum of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcadd)
|
||||
@@ -214,7 +229,7 @@ PHP_FUNCTION(bcadd)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -225,11 +240,12 @@ PHP_FUNCTION(bcadd)
|
||||
php_str2num(&first, left TSRMLS_CC);
|
||||
php_str2num(&second, right TSRMLS_CC);
|
||||
bc_add (first, second, &result, scale);
|
||||
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
@@ -253,7 +269,7 @@ PHP_FUNCTION(bcsub)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -266,6 +282,7 @@ PHP_FUNCTION(bcsub)
|
||||
bc_sub (first, second, &result, scale);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -292,11 +309,11 @@ PHP_FUNCTION(bcmul)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -305,6 +322,7 @@ PHP_FUNCTION(bcmul)
|
||||
bc_multiply (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -331,11 +349,11 @@ PHP_FUNCTION(bcdiv)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -345,6 +363,7 @@ PHP_FUNCTION(bcdiv)
|
||||
switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
|
||||
case 0: /* OK */
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -374,13 +393,13 @@ PHP_FUNCTION(bcmod)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
bc_str2num(&first, left, 0 TSRMLS_CC);
|
||||
bc_str2num(&second, right, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
|
||||
case 0:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -391,7 +410,7 @@ PHP_FUNCTION(bcmod)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
@@ -424,8 +443,9 @@ PHP_FUNCTION(bcpowmod)
|
||||
scale_int = (int) ((int)scale < 0) ? 0 : scale;
|
||||
|
||||
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
||||
if (result->n_scale > scale) {
|
||||
result->n_scale = scale;
|
||||
if (result->n_scale > scale_int) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale_int;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
@@ -433,7 +453,7 @@ PHP_FUNCTION(bcpowmod)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
@@ -455,7 +475,7 @@ PHP_FUNCTION(bcpow)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -468,6 +488,7 @@ PHP_FUNCTION(bcpow)
|
||||
bc_raise (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -494,16 +515,17 @@ PHP_FUNCTION(bcsqrt)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 2) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
php_str2num(&result, left TSRMLS_CC);
|
||||
|
||||
|
||||
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -531,7 +553,7 @@ PHP_FUNCTION(bccomp)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -555,7 +577,7 @@ PHP_FUNCTION(bccomp)
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
long new_scale;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod(1, "A", 128, -200));
|
||||
var_dump(bcpowmod(1, 1.2, 1, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
bc math warning: non-zero scale in exponent
|
||||
string(3) "0.0"
|
||||
+68
-62
@@ -593,7 +593,7 @@ static zend_object_handlers date_object_handlers_period;
|
||||
#define DATE_SET_CONTEXT \
|
||||
zval *object; \
|
||||
object = getThis(); \
|
||||
|
||||
|
||||
#define DATE_FETCH_OBJECT \
|
||||
php_date_obj *obj; \
|
||||
DATE_SET_CONTEXT; \
|
||||
@@ -762,7 +762,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt
|
||||
* FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
|
||||
* CFWS = *([FWS] comment) (([FWS] comment) / FWS)
|
||||
*
|
||||
*
|
||||
* date-time = [ day-of-week "," ] date FWS time [CFWS]
|
||||
* day-of-week = ([FWS] day-name)
|
||||
* day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
|
||||
@@ -784,19 +784,19 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* date-fullyear = 4DIGIT
|
||||
* date-month = 2DIGIT ; 01-12
|
||||
* date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
|
||||
*
|
||||
*
|
||||
* time-hour = 2DIGIT ; 00-23
|
||||
* time-minute = 2DIGIT ; 00-59
|
||||
* time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
|
||||
*
|
||||
*
|
||||
* time-secfrac = "." 1*DIGIT
|
||||
* time-numoffset = ("+" / "-") time-hour ":" time-minute
|
||||
* time-offset = "Z" / time-numoffset
|
||||
*
|
||||
*
|
||||
* partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
|
||||
* full-date = date-fullyear "-" date-month "-" date-mday
|
||||
* full-time = partial-time time-offset
|
||||
*
|
||||
*
|
||||
* date-time = full-date "T" full-time
|
||||
*/
|
||||
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
|
||||
@@ -889,7 +889,7 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
PHP_MINFO_FUNCTION(date)
|
||||
{
|
||||
const timelib_tzdb *tzdb = DATE_TIMEZONEDB;
|
||||
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "date/time support", "enabled");
|
||||
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
|
||||
@@ -1041,8 +1041,8 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
|
||||
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
@@ -1050,8 +1050,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1083,7 +1083,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
localtime ? abs(offset->offset / 3600) : 0,
|
||||
localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1129,7 +1129,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
|
||||
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
|
||||
case 'B': {
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||
}
|
||||
|
||||
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
|
||||
|
||||
|
||||
RETVAL_STRING(string, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1253,7 +1253,7 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
|
||||
}
|
||||
|
||||
string = date_format(format, format_len, t, localtime);
|
||||
|
||||
|
||||
timelib_time_dtor(t);
|
||||
return string;
|
||||
}
|
||||
@@ -1294,7 +1294,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
!localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
!localtime ? abs(offset->offset / 3600) : 0,
|
||||
!localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1326,7 +1326,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
|
||||
/* Swatch Beat a.k.a. Internet Time */
|
||||
case 'B':
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1378,7 +1378,7 @@ PHP_FUNCTION(idate)
|
||||
char *format;
|
||||
int format_len;
|
||||
long ts = 0;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1406,7 +1406,7 @@ PHP_FUNCTION(idate)
|
||||
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
{
|
||||
const timelib_tzdb *builtin = timelib_builtin_db();
|
||||
|
||||
|
||||
if (php_version_compare(tzdb->version, builtin->version) > 0) {
|
||||
php_date_global_timezone_db = tzdb;
|
||||
php_date_global_timezone_db_enabled = 1;
|
||||
@@ -1477,7 +1477,7 @@ PHP_FUNCTION(strtotime)
|
||||
}
|
||||
|
||||
if (!time_len) {
|
||||
timelib_time_dtor(now);
|
||||
timelib_time_dtor(now);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1926,7 +1926,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
|
||||
if (it_time->tz_info) {
|
||||
newdateobj->time->tz_info = it_time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
*data = &iterator->current;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2120,13 +2120,13 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
|
||||
if (ptr) {
|
||||
*ptr = intern;
|
||||
}
|
||||
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_date;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2140,12 +2140,12 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->time) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
@@ -2155,7 +2155,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2272,10 +2272,10 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_timezone;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2289,12 +2289,12 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
php_timezone_obj *new_obj = NULL;
|
||||
php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->initialized) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
new_obj->type = old_obj->type;
|
||||
new_obj->initialized = 1;
|
||||
switch (new_obj->type) {
|
||||
@@ -2310,7 +2310,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
new_obj->tzi.z.abbr = strdup(old_obj->tzi.z.abbr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2371,10 +2371,10 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_interval;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2388,7 +2388,7 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
|
||||
php_interval_obj *new_obj = NULL;
|
||||
php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2460,10 +2460,10 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_period;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2477,7 +2477,7 @@ static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
|
||||
php_period_obj *new_obj = NULL;
|
||||
php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2563,7 +2563,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
|
||||
char *new_abbr = NULL;
|
||||
timelib_sll new_offset;
|
||||
|
||||
|
||||
if (dateobj->time) {
|
||||
timelib_time_dtor(dateobj->time);
|
||||
}
|
||||
@@ -2942,7 +2942,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
|
||||
if (parsed_time->f == -99999) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
@@ -3009,7 +3009,7 @@ PHP_FUNCTION(date_parse)
|
||||
int date_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3028,7 +3028,7 @@ PHP_FUNCTION(date_parse_from_format)
|
||||
int date_len, format_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3512,7 +3512,7 @@ static void php_date_isodate_set(zval *object, long y, long w, long d, zval *ret
|
||||
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
|
||||
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
|
||||
dateobj->time->have_relative = 1;
|
||||
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
}
|
||||
|
||||
@@ -3701,7 +3701,7 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
int tz_len;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
tzobj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
@@ -3979,7 +3979,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4138,7 +4138,7 @@ PHP_METHOD(DateInterval, __construct)
|
||||
php_interval_obj *diobj;
|
||||
timelib_rel_time *reltime;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
|
||||
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
|
||||
@@ -4161,8 +4161,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_long(*z_arg); \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS && Z_TYPE_PP(z_arg) == IS_LONG) { \
|
||||
(*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = (itype)def; \
|
||||
@@ -4173,8 +4172,15 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_string(*z_arg); \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
if (Z_TYPE_PP(z_arg) == IS_STRING) { \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_LONG || Z_TYPE_PP(z_arg) == IS_BOOL) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_LVAL_PP(z_arg); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_DOUBLE) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_DVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
@@ -4352,7 +4358,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -4381,7 +4387,7 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
int isostr_len = 0;
|
||||
timelib_time *clone;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_interface, &options) == FAILURE) {
|
||||
@@ -4496,7 +4502,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
tzdb = DATE_TIMEZONEDB;
|
||||
item_count = tzdb->index_size;
|
||||
table = tzdb->index;
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
for (i = 0; i < item_count; ++i) {
|
||||
@@ -4530,7 +4536,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
|
||||
{
|
||||
const timelib_tz_lookup_table *table, *entry;
|
||||
zval *element, **abbr_array_pp, *abbr_array;
|
||||
|
||||
|
||||
table = timelib_timezone_abbreviations_list();
|
||||
array_init(return_value);
|
||||
entry = table;
|
||||
@@ -4606,11 +4612,11 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_time *t;
|
||||
timelib_tzinfo *tzi;
|
||||
char *retstr;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
retformat = SUNFUNCS_RET_STRING;
|
||||
@@ -4654,7 +4660,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_unixtime2local(t, time);
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, 1, &h_rise, &h_set, &rise, &set, &transit);
|
||||
timelib_time_dtor(t);
|
||||
|
||||
|
||||
if (rs != 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4708,7 +4714,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
timelib_sll rise, set, transit;
|
||||
int dummy;
|
||||
double ddummy;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4722,7 +4728,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
/* Setup */
|
||||
t2 = timelib_time_ctor();
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
/* Get sun up/down and transit */
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
|
||||
switch (rs) {
|
||||
@@ -4866,7 +4872,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
|
||||
ZVAL_NULL(zv);
|
||||
}
|
||||
zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
|
||||
|
||||
|
||||
/* converted to larger type (int->long); must check when unserializing */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, (long) period_obj->recurrences);
|
||||
@@ -4949,7 +4955,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
}
|
||||
|
||||
period_obj->initialized = 1;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4966,7 +4972,7 @@ PHP_METHOD(DatePeriod, __set_state)
|
||||
}
|
||||
|
||||
myht = Z_ARRVAL_P(array);
|
||||
|
||||
|
||||
object_init_ex(return_value, date_ce_period);
|
||||
period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
+121
-108
@@ -74,7 +74,7 @@
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/php_string.h"
|
||||
#include "ext/standard/php_image.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
/* needed for ssize_t definition */
|
||||
#include <sys/types.h>
|
||||
@@ -161,7 +161,7 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
|
||||
char * encode_jis;
|
||||
char * decode_jis_be;
|
||||
char * decode_jis_le;
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
ZEND_END_MODULE_GLOBALS(exif)
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
|
||||
@@ -170,7 +170,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
|
||||
#else
|
||||
#define EXIF_G(v) (exif_globals.v)
|
||||
#endif
|
||||
|
||||
|
||||
/* {{{ PHP_INI
|
||||
*/
|
||||
|
||||
@@ -213,7 +213,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ PHP_GINIT_FUNCTION
|
||||
*/
|
||||
static PHP_GINIT_FUNCTION(exif)
|
||||
@@ -233,9 +233,9 @@ PHP_MINIT_FUNCTION(exif)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT);
|
||||
} else {
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ zend_module_entry exif_module_entry = {
|
||||
exif_module_deps,
|
||||
"exif",
|
||||
exif_functions,
|
||||
PHP_MINIT(exif),
|
||||
PHP_MINIT(exif),
|
||||
PHP_MSHUTDOWN(exif),
|
||||
NULL, NULL,
|
||||
PHP_MINFO(exif),
|
||||
@@ -278,7 +278,7 @@ zend_module_entry exif_module_entry = {
|
||||
NULL,
|
||||
NULL,
|
||||
STANDARD_MODULE_PROPERTIES_EX
|
||||
#else
|
||||
#else
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
#endif
|
||||
};
|
||||
@@ -667,73 +667,73 @@ static tag_info_array tag_table_IFD = {
|
||||
{ 0x0213, "YCbCrPositioning"},
|
||||
{ 0x0214, "ReferenceBlackWhite"},
|
||||
{ 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x0301, "Gamma"},
|
||||
{ 0x0302, "ICCProfileDescriptor"},
|
||||
{ 0x0303, "SRGBRenderingIntent"},
|
||||
{ 0x0320, "ImageTitle"},
|
||||
{ 0x5001, "ResolutionXUnit"},
|
||||
{ 0x5002, "ResolutionYUnit"},
|
||||
{ 0x5003, "ResolutionXLengthUnit"},
|
||||
{ 0x5004, "ResolutionYLengthUnit"},
|
||||
{ 0x5005, "PrintFlags"},
|
||||
{ 0x5006, "PrintFlagsVersion"},
|
||||
{ 0x5007, "PrintFlagsCrop"},
|
||||
{ 0x5008, "PrintFlagsBleedWidth"},
|
||||
{ 0x5009, "PrintFlagsBleedWidthScale"},
|
||||
{ 0x500A, "HalftoneLPI"},
|
||||
{ 0x500B, "HalftoneLPIUnit"},
|
||||
{ 0x500C, "HalftoneDegree"},
|
||||
{ 0x500D, "HalftoneShape"},
|
||||
{ 0x500E, "HalftoneMisc"},
|
||||
{ 0x500F, "HalftoneScreen"},
|
||||
{ 0x5010, "JPEGQuality"},
|
||||
{ 0x5011, "GridSize"},
|
||||
{ 0x5012, "ThumbnailFormat"},
|
||||
{ 0x5013, "ThumbnailWidth"},
|
||||
{ 0x5014, "ThumbnailHeight"},
|
||||
{ 0x5015, "ThumbnailColorDepth"},
|
||||
{ 0x5016, "ThumbnailPlanes"},
|
||||
{ 0x5017, "ThumbnailRawBytes"},
|
||||
{ 0x5018, "ThumbnailSize"},
|
||||
{ 0x5019, "ThumbnailCompressedSize"},
|
||||
{ 0x501A, "ColorTransferFunction"},
|
||||
{ 0x501B, "ThumbnailData"},
|
||||
{ 0x5020, "ThumbnailImageWidth"},
|
||||
{ 0x5021, "ThumbnailImageHeight"},
|
||||
{ 0x5022, "ThumbnailBitsPerSample"},
|
||||
{ 0x5023, "ThumbnailCompression"},
|
||||
{ 0x5024, "ThumbnailPhotometricInterp"},
|
||||
{ 0x5025, "ThumbnailImageDescription"},
|
||||
{ 0x5026, "ThumbnailEquipMake"},
|
||||
{ 0x5027, "ThumbnailEquipModel"},
|
||||
{ 0x5028, "ThumbnailStripOffsets"},
|
||||
{ 0x5029, "ThumbnailOrientation"},
|
||||
{ 0x502A, "ThumbnailSamplesPerPixel"},
|
||||
{ 0x502B, "ThumbnailRowsPerStrip"},
|
||||
{ 0x502C, "ThumbnailStripBytesCount"},
|
||||
{ 0x502D, "ThumbnailResolutionX"},
|
||||
{ 0x502E, "ThumbnailResolutionY"},
|
||||
{ 0x502F, "ThumbnailPlanarConfig"},
|
||||
{ 0x5030, "ThumbnailResolutionUnit"},
|
||||
{ 0x5031, "ThumbnailTransferFunction"},
|
||||
{ 0x5032, "ThumbnailSoftwareUsed"},
|
||||
{ 0x5033, "ThumbnailDateTime"},
|
||||
{ 0x5034, "ThumbnailArtist"},
|
||||
{ 0x5035, "ThumbnailWhitePoint"},
|
||||
{ 0x5036, "ThumbnailPrimaryChromaticities"},
|
||||
{ 0x5037, "ThumbnailYCbCrCoefficients"},
|
||||
{ 0x5038, "ThumbnailYCbCrSubsampling"},
|
||||
{ 0x5039, "ThumbnailYCbCrPositioning"},
|
||||
{ 0x503A, "ThumbnailRefBlackWhite"},
|
||||
{ 0x503B, "ThumbnailCopyRight"},
|
||||
{ 0x5090, "LuminanceTable"},
|
||||
{ 0x5091, "ChrominanceTable"},
|
||||
{ 0x5100, "FrameDelay"},
|
||||
{ 0x5101, "LoopCount"},
|
||||
{ 0x5110, "PixelUnit"},
|
||||
{ 0x5111, "PixelPerUnitX"},
|
||||
{ 0x5112, "PixelPerUnitY"},
|
||||
{ 0x5113, "PaletteHistogram"},
|
||||
{ 0x1000, "RelatedImageFileFormat"},
|
||||
{ 0x800D, "ImageID"},
|
||||
{ 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */
|
||||
@@ -939,7 +939,7 @@ static tag_info_array tag_table_VND_NIKON = {
|
||||
{ 0x000b, "Converter"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0001, "Version"},
|
||||
{ 0x0002, "ISOSetting"},
|
||||
@@ -958,7 +958,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
|
||||
{ 0x0010, "DataDump"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
|
||||
static tag_info_array tag_table_VND_OLYMPUS = {
|
||||
{ 0x0200, "SpecialMode"},
|
||||
{ 0x0201, "JPEGQuality"},
|
||||
@@ -1224,7 +1224,7 @@ char * exif_dump_data(int *dump_free, int format, int components, int length, in
|
||||
if (components > 0) {
|
||||
dump = erealloc(dump, len + 2 + 1);
|
||||
snprintf(dump + len, 2 + 1, ", ");
|
||||
len += 2;
|
||||
len += 2;
|
||||
components--;
|
||||
} else{
|
||||
break;
|
||||
@@ -1574,7 +1574,7 @@ typedef struct {
|
||||
static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
||||
va_start(args, format);
|
||||
#ifdef EXIF_DEBUG
|
||||
{
|
||||
@@ -2627,7 +2627,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
|
||||
* since we have no encoding support for the BOM yet we skip that.
|
||||
*/
|
||||
if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
|
||||
@@ -2645,8 +2645,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
}
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2666,8 +2666,8 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
@@ -2701,12 +2701,12 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
* Process unicode field in IFD. */
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
xp_field->tag = tag;
|
||||
xp_field->value = NULL;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char**)&xp_field->value,
|
||||
&xp_field->size,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
@@ -2731,7 +2731,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
|
||||
return FALSE;
|
||||
maker_note = maker_note_array+i;
|
||||
|
||||
|
||||
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
|
||||
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
|
||||
continue;
|
||||
@@ -2852,9 +2852,9 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
|
||||
/* If its bigger than 4 bytes, the dir entry contains an offset. */
|
||||
value_ptr = offset_base+offset_val;
|
||||
/*
|
||||
/*
|
||||
dir_entry is ImageInfo->file.list[sn].data+2+i*12
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
offset_base is ImageInfo->file.list[sn].data-dir_offset
|
||||
dir_entry - offset_base is dir_offset+2+i*12
|
||||
*/
|
||||
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
|
||||
@@ -2925,18 +2925,18 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
case TAG_COMP_IMAGE_WIDTH:
|
||||
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_IMAGEHEIGHT:
|
||||
case TAG_COMP_IMAGE_HEIGHT:
|
||||
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_OFFSETS:
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
/* accept both formats */
|
||||
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_STRIP_BYTE_COUNTS:
|
||||
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
|
||||
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
|
||||
@@ -2946,7 +2946,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC);
|
||||
break;
|
||||
|
||||
|
||||
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
|
||||
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
|
||||
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
|
||||
@@ -2964,16 +2964,16 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
if (length<byte_count-1) {
|
||||
/* When there are any characters after the first NUL */
|
||||
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
|
||||
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
|
||||
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->CopyrightEditor);
|
||||
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
|
||||
/* but we are not supposed to change this */
|
||||
/* keep in mind that image_info does not store editor value */
|
||||
} else {
|
||||
ImageInfo->Copyright = estrdup(value_ptr);
|
||||
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case TAG_USERCOMMENT:
|
||||
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC);
|
||||
@@ -3061,10 +3061,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
break;
|
||||
|
||||
case TAG_MAKE:
|
||||
ImageInfo->make = estrdup(value_ptr);
|
||||
ImageInfo->make = estrndup(value_ptr, byte_count);
|
||||
break;
|
||||
case TAG_MODEL:
|
||||
ImageInfo->model = estrdup(value_ptr);
|
||||
ImageInfo->model = estrndup(value_ptr, byte_count);
|
||||
break;
|
||||
|
||||
case TAG_MAKER_NOTE:
|
||||
@@ -3134,6 +3134,11 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
|
||||
if ((dir_start + 2) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
|
||||
|
||||
if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
|
||||
@@ -3157,6 +3162,10 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
* Hack to make it process IDF1 I hope
|
||||
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
|
||||
*/
|
||||
if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
|
||||
if (NextDirOffset) {
|
||||
/* the next line seems false but here IFDlength means length of all IFDs */
|
||||
@@ -3206,9 +3215,13 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
|
||||
}
|
||||
|
||||
/* Check the next two values for correctness. */
|
||||
if (length < 8) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel);
|
||||
offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel);
|
||||
if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
if (exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
@@ -3414,7 +3427,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
if ((itemlen - 2) < 6) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
exif_process_SOFn(Data, marker, &sof_info);
|
||||
ImageInfo->Width = sof_info.width;
|
||||
ImageInfo->Height = sof_info.height;
|
||||
@@ -3459,21 +3472,21 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
|
||||
}
|
||||
for (;;) {
|
||||
pos += length;
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
c = data[pos++];
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
if (pos>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
if (c != 0xFF) {
|
||||
return FALSE;
|
||||
}
|
||||
n = 8;
|
||||
while ((c = data[pos++]) == 0xFF && n--) {
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
if (pos+3>=ImageInfo->Thumbnail.size)
|
||||
return FALSE;
|
||||
/* +3 = pos++ of next check when reaching marker + 2 bytes for length */
|
||||
}
|
||||
if (c == 0xFF)
|
||||
if (c == 0xFF)
|
||||
return FALSE;
|
||||
marker = c;
|
||||
length = php_jpg_get16(data+pos);
|
||||
@@ -3787,7 +3800,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format");
|
||||
#endif
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
if (exif_process_IFD_in_TIFF(ImageInfo,
|
||||
php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel),
|
||||
SECTION_IFD0 TSRMLS_CC)) {
|
||||
ret = TRUE;
|
||||
@@ -3967,7 +3980,7 @@ PHP_FUNCTION(exif_read_data)
|
||||
sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC);
|
||||
|
||||
#ifdef EXIF_DEBUG
|
||||
if (sections_str)
|
||||
if (sections_str)
|
||||
exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Bug #72094: Out of bounds heap read access in exif header processing
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_1.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_2.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_3.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_4.jpg'));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Illegal IFD size in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid TIFF start (1) in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): File structure corrupted in %s/bug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid JPEG file in %s/bug72094.php on line %d
|
||||
DONE
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -414,7 +414,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
|
||||
size_t len;
|
||||
|
||||
if (level >= ms->c.len) {
|
||||
len = (ms->c.len += 20) * sizeof(*ms->c.li);
|
||||
len = (ms->c.len = 20 + level) * sizeof(*ms->c.li);
|
||||
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
|
||||
emalloc(len) :
|
||||
erealloc(ms->c.li, len));
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #71527 Buffer over-write in finfo_open with malformed magic file
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--ENV--
|
||||
USE_ZEND_ALLOC=0
|
||||
--FILE--
|
||||
<?php
|
||||
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
|
||||
$info = finfo_file($finfo, __FILE__);
|
||||
var_dump($info);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
|
||||
|
||||
Warning: finfo_file() expects parameter 1 to be resource, boolean given in %sbug71527.php on line %d
|
||||
bool(false)
|
||||
@@ -145,9 +145,15 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
cidx = gdCalloc(sidx, 1);
|
||||
for (i = 0; i < nc; i++) {
|
||||
if (gdGetInt(&cidx[i].offset, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (gdGetInt(&cidx[i].size, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (cidx[i].offset < 0 || cidx[i].size < 0) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2162,7 +2162,7 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
|
||||
images can be done at a later point.
|
||||
*/
|
||||
if (src->trueColor == 0) {
|
||||
if (bgcolor >= 0) {
|
||||
if (bgcolor < gdMaxColors) {
|
||||
bgcolor = gdTrueColorAlpha(src->red[bgcolor], src->green[bgcolor], src->blue[bgcolor], src->alpha[bgcolor]);
|
||||
}
|
||||
gdImagePaletteToTrueColor(src);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #70976 (Memory Read via gdImageRotateInterpolated Array Index Out of Bounds)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagerotate(imagecreate(10,10),45,0x7ffffff9);
|
||||
var_dump($img);
|
||||
?>
|
||||
--EXPECTF--
|
||||
resource(5) of type (gd)
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #71912 (libgd: signedness vulnerability)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imagecreatefromgd2(__DIR__."/invalid_neg_size.gd2");
|
||||
?>
|
||||
OK
|
||||
--EXPECTF--
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s/invalid_neg_size.gd2' is not a valid GD2 file in %s/bug71912.php on line %d
|
||||
OK
|
||||
Binary file not shown.
@@ -336,7 +336,7 @@ PHP_HASH_API void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -390,7 +390,7 @@ PHP_HASH_API void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -444,7 +444,7 @@ PHP_HASH_API void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -484,7 +484,7 @@ PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
@@ -525,7 +525,7 @@ PHP_HASH_API void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * conte
|
||||
|
||||
/* Pad out to 118 mod 128.
|
||||
*/
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
|
||||
index = (unsigned int) ((context->count[0] >> 3) & 0x7f);
|
||||
padLen = (index < 118) ? (118 - index) : (246 - index);
|
||||
PHP_HAVALUpdate(context, PADDING, padLen);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #70312 HAVAL gives wrong hashes in specific cases
|
||||
--SKIPIF--
|
||||
<?php if(!extension_loaded("hash")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(hash('haval128,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval160,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval192,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval224,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
var_dump(hash('haval256,5', '1234567890123456789012345678901234567890123456789012345678901234'));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(32) "f3f0d23819b87228b4b70ee350afaa9d"
|
||||
string(40) "aded6485e137f11d7292212ba3fa961714df0564"
|
||||
string(48) "e53da2b16269fe732e9a898a96707a9f28404d7333b02286"
|
||||
string(56) "c574fb307f0817b514b9bb2e7c4bfaffb7ad667aca3c8b523fefcf10"
|
||||
string(64) "fb73c19300b14d5cb393d929bf005e6c2d459a4c9c009e9813af1d2d3637ee8f"
|
||||
@@ -64,7 +64,7 @@ unlink($file);
|
||||
adler32: ff87222e
|
||||
crc32: 61664d33
|
||||
gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd
|
||||
haval128,3: 8bb81269aca8b7f87829020d76a4e841
|
||||
haval128,3: c25962b13383c3ed9f13817c8f2ae7d6
|
||||
md2: 70f791c0d8fa9edd7d08e32fcba8c354
|
||||
md4: a9d034b16bb290c57a645afd6f14cd3b
|
||||
md5: 704bf818448f5bbb94061332d2c889aa
|
||||
|
||||
@@ -45,7 +45,7 @@ echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n"
|
||||
adler32: 12c803f7
|
||||
crc32: 96859101
|
||||
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
|
||||
haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5
|
||||
haval128,3: 4d1318607f0406bd1b7bd50907772672
|
||||
md2: 6d111dab563025e4cb5f4425c991fa12
|
||||
md4: 10cdbfe843000c623f8b8da0d5d20b0b
|
||||
md5: 2a632783e2812cf23de100d7d6a463ae
|
||||
|
||||
@@ -73,7 +73,7 @@ unlink($file);
|
||||
adler32: 0f8c02f9
|
||||
crc32: f2a60b9c
|
||||
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
|
||||
haval128,3: e8fcff647f1a675acb429130fb94a17e
|
||||
haval128,3: f1cea637451097d790354a86de3f54a3
|
||||
md2: a685475e600314bb549ab4f33c3b27cb
|
||||
md4: cbc6bff781f48f57378d3effa27553e4
|
||||
md5: 8bddf39dd1c566c27acc7fa85ec36acf
|
||||
|
||||
@@ -112,7 +112,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
int haystack_len, needle_len;
|
||||
unsigned char *found;
|
||||
long loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t offset = 0, noffset = 0;
|
||||
int ret_pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
@@ -132,6 +132,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
|
||||
/* we checked that it will fit: */
|
||||
offset = (int32_t) loffset;
|
||||
noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
|
||||
/* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */
|
||||
|
||||
@@ -146,7 +147,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
/* quick check to see if the string might be there
|
||||
* I realize that 'offset' is 'grapheme count offset' but will work in spite of that
|
||||
*/
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + offset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + noffset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
|
||||
/* if it isn't there the we are done */
|
||||
if (!found) {
|
||||
@@ -214,12 +215,13 @@ PHP_FUNCTION(grapheme_stripos)
|
||||
is_ascii = ( grapheme_ascii_check(haystack, haystack_len) >= 0 );
|
||||
|
||||
if ( is_ascii ) {
|
||||
int32_t noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
needle_dup = (unsigned char *)estrndup((char *)needle, needle_len);
|
||||
php_strtolower((char *)needle_dup, needle_len);
|
||||
haystack_dup = (unsigned char *)estrndup((char *)haystack, haystack_len);
|
||||
php_strtolower((char *)haystack_dup, haystack_len);
|
||||
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + offset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + noffset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
|
||||
efree(haystack_dup);
|
||||
efree(needle_dup);
|
||||
@@ -537,7 +539,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
efree(ustr);
|
||||
}
|
||||
ubrk_close(bi);
|
||||
RETURN_EMPTY_STRING();
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
/* find the end point of the string to return */
|
||||
@@ -576,7 +578,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
sub_str_end_pos = ustr_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(sub_str_start_pos > sub_str_end_pos) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length is beyond start", 1 TSRMLS_CC );
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
setlocale(LC_ALL, 'de_DE');
|
||||
setlocale(LC_ALL, 'de_DE.UTF-8');
|
||||
$fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
|
||||
$num = "1.234.567,891";
|
||||
$res_str = $fmt->parse($num)."\n";
|
||||
@@ -26,5 +26,5 @@ ut_run();
|
||||
?>
|
||||
--EXPECT--
|
||||
1234567,891
|
||||
de_DE
|
||||
de_DE.UTF-8
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72061: Out-of-bounds reads in zif_grapheme_stripos with negative offset
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
var_dump(grapheme_stripos(str_repeat("ABCD", 16384), "A", -201));
|
||||
var_dump(grapheme_strpos(str_repeat("ABCD", 16384), "A", -201));
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
int(65336)
|
||||
int(65336)
|
||||
DONE
|
||||
@@ -72,7 +72,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Unicode support
|
||||
*
|
||||
* Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
|
||||
@@ -137,7 +137,7 @@ mbfl_buffer_converter_new(
|
||||
mbfl_buffer_converter *
|
||||
mbfl_buffer_converter_new2(
|
||||
const mbfl_encoding *from,
|
||||
const mbfl_encoding *to,
|
||||
const mbfl_encoding *to,
|
||||
int buf_initsz)
|
||||
{
|
||||
mbfl_buffer_converter *convd;
|
||||
@@ -339,7 +339,7 @@ mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result)
|
||||
}
|
||||
|
||||
mbfl_string *
|
||||
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
|
||||
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
|
||||
mbfl_string *result)
|
||||
{
|
||||
if (convd == NULL || string == NULL || result == NULL) {
|
||||
@@ -535,7 +535,7 @@ const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *ident
|
||||
}
|
||||
n--;
|
||||
}
|
||||
|
||||
|
||||
/* fallback judge */
|
||||
if (!encoding) {
|
||||
n = identd->filter_list_size - 1;
|
||||
@@ -702,7 +702,7 @@ mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int el
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cleanup */
|
||||
/* dtors should be called in reverse order */
|
||||
i = num; while (--i >= 0) {
|
||||
@@ -785,7 +785,7 @@ mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int el
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cleanup */
|
||||
/* dtors should be called in reverse order */
|
||||
i = num; while (--i >= 0) {
|
||||
@@ -844,7 +844,7 @@ mbfl_strlen(mbfl_string *string)
|
||||
} else {
|
||||
/* wchar filter */
|
||||
mbfl_convert_filter *filter = mbfl_convert_filter_new(
|
||||
string->no_encoding,
|
||||
string->no_encoding,
|
||||
mbfl_no_encoding_wchar,
|
||||
filter_count_output, 0, &len);
|
||||
if (filter == NULL) {
|
||||
@@ -865,7 +865,7 @@ mbfl_strlen(mbfl_string *string)
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* strpos
|
||||
*/
|
||||
@@ -931,7 +931,7 @@ retry:
|
||||
/*
|
||||
* oddlen
|
||||
*/
|
||||
int
|
||||
int
|
||||
mbfl_oddlen(mbfl_string *string)
|
||||
{
|
||||
int len, n, m, k;
|
||||
@@ -1071,7 +1071,7 @@ mbfl_strpos(
|
||||
++result;
|
||||
} else if ((c & 0xc0) != 0x80) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ mbfl_strpos(
|
||||
qe = needle_u8_val + needle_u8_len;
|
||||
if (offset < 0) {
|
||||
if (-offset > needle_len) {
|
||||
offset += needle_len;
|
||||
offset += needle_len;
|
||||
while (offset < 0) {
|
||||
unsigned char c;
|
||||
if (p <= e) {
|
||||
@@ -1158,7 +1158,7 @@ mbfl_strpos(
|
||||
++result;
|
||||
} else if ((c & 0xc0) != 0x80) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
@@ -1501,7 +1501,7 @@ mbfl_strcut(
|
||||
if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
|
||||
from &= -2;
|
||||
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
@@ -1510,14 +1510,14 @@ mbfl_strcut(
|
||||
} else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
|
||||
from &= -4;
|
||||
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
start = string->val + from;
|
||||
end = start + (length & -4);
|
||||
} else if ((encoding->flag & MBFL_ENCTYPE_SBCS)) {
|
||||
if (from + length >= string->len) {
|
||||
if (length >= string->len - from) {
|
||||
length = string->len - from;
|
||||
}
|
||||
|
||||
@@ -1539,7 +1539,7 @@ mbfl_strcut(
|
||||
start = p;
|
||||
|
||||
/* search end position */
|
||||
if ((start - string->val) + length >= (int)string->len) {
|
||||
if (length >= (int)string->len - (start - string->val)) {
|
||||
end = string->val + string->len;
|
||||
} else {
|
||||
for (q = p + length; p < q; p += (m = mbtab[*p]));
|
||||
@@ -2024,7 +2024,7 @@ mbfl_ja_jp_hantozen(
|
||||
mbfl_no_encoding_wchar,
|
||||
(int(*)(int, void*))next_filter->filter_function,
|
||||
(int(*)(void*))next_filter->filter_flush,
|
||||
next_filter);
|
||||
next_filter);
|
||||
if (encoder == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -5136,7 +5136,6 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
long buffer_length;
|
||||
unsigned char *buffer = NULL;
|
||||
zval *zstrong_result_returned = NULL;
|
||||
int strong_result = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) {
|
||||
return;
|
||||
@@ -5154,7 +5153,6 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
buffer = emalloc(buffer_length + 1);
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
strong_result = 1;
|
||||
/* random/urandom equivalent on Windows */
|
||||
if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){
|
||||
efree(buffer);
|
||||
@@ -5164,7 +5162,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#else
|
||||
if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) {
|
||||
if (RAND_bytes(buffer, buffer_length) <= 0) {
|
||||
efree(buffer);
|
||||
if (zstrong_result_returned) {
|
||||
ZVAL_BOOL(zstrong_result_returned, 0);
|
||||
@@ -5177,7 +5175,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||
RETVAL_STRINGL((char *)buffer, buffer_length, 0);
|
||||
|
||||
if (zstrong_result_returned) {
|
||||
ZVAL_BOOL(zstrong_result_returned, strong_result);
|
||||
ZVAL_BOOL(zstrong_result_returned, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1,6 +1,182 @@
|
||||
ChangeLog for PCRE
|
||||
------------------
|
||||
|
||||
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
|
||||
development is happening in the PCRE2 10.xx series.
|
||||
|
||||
Version 8.38 23-November-2015
|
||||
-----------------------------
|
||||
|
||||
1. If a group that contained a recursive back reference also contained a
|
||||
forward reference subroutine call followed by a non-forward-reference
|
||||
subroutine call, for example /.((?2)(?R)\1)()/, pcre2_compile() failed to
|
||||
compile correct code, leading to undefined behaviour or an internally
|
||||
detected error. This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
2. Quantification of certain items (e.g. atomic back references) could cause
|
||||
incorrect code to be compiled when recursive forward references were
|
||||
involved. For example, in this pattern: /(?1)()((((((\1++))\x85)+)|))/.
|
||||
This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
3. A repeated conditional group whose condition was a reference by name caused
|
||||
a buffer overflow if there was more than one group with the given name.
|
||||
This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
4. A recursive back reference by name within a group that had the same name as
|
||||
another group caused a buffer overflow. For example:
|
||||
/(?J)(?'d'(?'d'\g{d}))/. This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
5. A forward reference by name to a group whose number is the same as the
|
||||
current group, for example in this pattern: /(?|(\k'Pm')|(?'Pm'))/, caused
|
||||
a buffer overflow at compile time. This bug was discovered by the LLVM
|
||||
fuzzer.
|
||||
|
||||
6. A lookbehind assertion within a set of mutually recursive subpatterns could
|
||||
provoke a buffer overflow. This bug was discovered by the LLVM fuzzer.
|
||||
|
||||
7. Another buffer overflow bug involved duplicate named groups with a
|
||||
reference between their definition, with a group that reset capture
|
||||
numbers, for example: /(?J:(?|(?'R')(\k'R')|((?'R'))))/. This has been
|
||||
fixed by always allowing for more memory, even if not needed. (A proper fix
|
||||
is implemented in PCRE2, but it involves more refactoring.)
|
||||
|
||||
8. There was no check for integer overflow in subroutine calls such as (?123).
|
||||
|
||||
9. The table entry for \l in EBCDIC environments was incorrect, leading to its
|
||||
being treated as a literal 'l' instead of causing an error.
|
||||
|
||||
10. There was a buffer overflow if pcre_exec() was called with an ovector of
|
||||
size 1. This bug was found by american fuzzy lop.
|
||||
|
||||
11. If a non-capturing group containing a conditional group that could match
|
||||
an empty string was repeated, it was not identified as matching an empty
|
||||
string itself. For example: /^(?:(?(1)x|)+)+$()/.
|
||||
|
||||
12. In an EBCDIC environment, pcretest was mishandling the escape sequences
|
||||
\a and \e in test subject lines.
|
||||
|
||||
13. In an EBCDIC environment, \a in a pattern was converted to the ASCII
|
||||
instead of the EBCDIC value.
|
||||
|
||||
14. The handling of \c in an EBCDIC environment has been revised so that it is
|
||||
now compatible with the specification in Perl's perlebcdic page.
|
||||
|
||||
15. The EBCDIC character 0x41 is a non-breaking space, equivalent to 0xa0 in
|
||||
ASCII/Unicode. This has now been added to the list of characters that are
|
||||
recognized as white space in EBCDIC.
|
||||
|
||||
16. When PCRE was compiled without UCP support, the use of \p and \P gave an
|
||||
error (correctly) when used outside a class, but did not give an error
|
||||
within a class.
|
||||
|
||||
17. \h within a class was incorrectly compiled in EBCDIC environments.
|
||||
|
||||
18. A pattern with an unmatched closing parenthesis that contained a backward
|
||||
assertion which itself contained a forward reference caused buffer
|
||||
overflow. And example pattern is: /(?=di(?<=(?1))|(?=(.))))/.
|
||||
|
||||
19. JIT should return with error when the compiled pattern requires more stack
|
||||
space than the maximum.
|
||||
|
||||
20. A possessively repeated conditional group that could match an empty string,
|
||||
for example, /(?(R))*+/, was incorrectly compiled.
|
||||
|
||||
21. Fix infinite recursion in the JIT compiler when certain patterns such as
|
||||
/(?:|a|){100}x/ are analysed.
|
||||
|
||||
22. Some patterns with character classes involving [: and \\ were incorrectly
|
||||
compiled and could cause reading from uninitialized memory or an incorrect
|
||||
error diagnosis.
|
||||
|
||||
23. Pathological patterns containing many nested occurrences of [: caused
|
||||
pcre_compile() to run for a very long time.
|
||||
|
||||
24. A conditional group with only one branch has an implicit empty alternative
|
||||
branch and must therefore be treated as potentially matching an empty
|
||||
string.
|
||||
|
||||
25. If (?R was followed by - or + incorrect behaviour happened instead of a
|
||||
diagnostic.
|
||||
|
||||
26. Arrange to give up on finding the minimum matching length for overly
|
||||
complex patterns.
|
||||
|
||||
27. Similar to (4) above: in a pattern with duplicated named groups and an
|
||||
occurrence of (?| it is possible for an apparently non-recursive back
|
||||
reference to become recursive if a later named group with the relevant
|
||||
number is encountered. This could lead to a buffer overflow. Wen Guanxing
|
||||
from Venustech ADLAB discovered this bug.
|
||||
|
||||
28. If pcregrep was given the -q option with -c or -l, or when handling a
|
||||
binary file, it incorrectly wrote output to stdout.
|
||||
|
||||
29. The JIT compiler did not restore the control verb head in case of *THEN
|
||||
control verbs. This issue was found by Karl Skomski with a custom LLVM
|
||||
fuzzer.
|
||||
|
||||
30. Error messages for syntax errors following \g and \k were giving inaccurate
|
||||
offsets in the pattern.
|
||||
|
||||
31. Added a check for integer overflow in conditions (?(<digits>) and
|
||||
(?(R<digits>). This omission was discovered by Karl Skomski with the LLVM
|
||||
fuzzer.
|
||||
|
||||
32. Handling recursive references such as (?2) when the reference is to a group
|
||||
later in the pattern uses code that is very hacked about and error-prone.
|
||||
It has been re-written for PCRE2. Here in PCRE1, a check has been added to
|
||||
give an internal error if it is obvious that compiling has gone wrong.
|
||||
|
||||
33. The JIT compiler should not check repeats after a {0,1} repeat byte code.
|
||||
This issue was found by Karl Skomski with a custom LLVM fuzzer.
|
||||
|
||||
34. The JIT compiler should restore the control chain for empty possessive
|
||||
repeats. This issue was found by Karl Skomski with a custom LLVM fuzzer.
|
||||
|
||||
35. Match limit check added to JIT recursion. This issue was found by Karl
|
||||
Skomski with a custom LLVM fuzzer.
|
||||
|
||||
36. Yet another case similar to 27 above has been circumvented by an
|
||||
unconditional allocation of extra memory. This issue is fixed "properly" in
|
||||
PCRE2 by refactoring the way references are handled. Wen Guanxing
|
||||
from Venustech ADLAB discovered this bug.
|
||||
|
||||
37. Fix two assertion fails in JIT. These issues were found by Karl Skomski
|
||||
with a custom LLVM fuzzer.
|
||||
|
||||
38. Fixed a corner case of range optimization in JIT.
|
||||
|
||||
39. An incorrect error "overran compiling workspace" was given if there were
|
||||
exactly enough group forward references such that the last one extended
|
||||
into the workspace safety margin. The next one would have expanded the
|
||||
workspace. The test for overflow was not including the safety margin.
|
||||
|
||||
40. A match limit issue is fixed in JIT which was found by Karl Skomski
|
||||
with a custom LLVM fuzzer.
|
||||
|
||||
41. Remove the use of /dev/null in testdata/testinput2, because it doesn't
|
||||
work under Windows. (Why has it taken so long for anyone to notice?)
|
||||
|
||||
42. In a character class such as [\W\p{Any}] where both a negative-type escape
|
||||
("not a word character") and a property escape were present, the property
|
||||
escape was being ignored.
|
||||
|
||||
43. Fix crash caused by very long (*MARK) or (*THEN) names.
|
||||
|
||||
44. A sequence such as [[:punct:]b] that is, a POSIX character class followed
|
||||
by a single ASCII character in a class item, was incorrectly compiled in
|
||||
UCP mode. The POSIX class got lost, but only if the single character
|
||||
followed it.
|
||||
|
||||
45. [:punct:] in UCP mode was matching some characters in the range 128-255
|
||||
that should not have been matched.
|
||||
|
||||
46. If [:^ascii:] or [:^xdigit:] or [:^cntrl:] are present in a non-negated
|
||||
class, all characters with code points greater than 255 are in the class.
|
||||
When a Unicode property was also in the class (if PCRE_UCP is set, escapes
|
||||
such as \w are turned into Unicode properties), wide characters were not
|
||||
correctly handled, and could fail to match.
|
||||
|
||||
|
||||
Version 8.37 28-April-2015
|
||||
--------------------------
|
||||
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
News about PCRE releases
|
||||
------------------------
|
||||
|
||||
Release 8.38 23-November-2015
|
||||
-----------------------------
|
||||
|
||||
This is bug-fix release. Note that this library (now called PCRE1) is now being
|
||||
maintained for bug fixes only. New projects are advised to use the new PCRE2
|
||||
libraries.
|
||||
|
||||
|
||||
Release 8.37 28-April-2015
|
||||
--------------------------
|
||||
|
||||
|
||||
@@ -234,8 +234,8 @@ them both to 0; an emulation function will be used. */
|
||||
#define LINK_SIZE 2
|
||||
#endif
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
/* This is ignored unless you are using libtool. */
|
||||
#ifndef LT_OBJDIR
|
||||
#define LT_OBJDIR ".libs/"
|
||||
#endif
|
||||
@@ -314,7 +314,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_NAME "PCRE"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "PCRE 8.37"
|
||||
#define PACKAGE_STRING "PCRE 8.38"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "pcre"
|
||||
@@ -323,7 +323,7 @@ them both to 0; an emulation function will be used. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "8.37"
|
||||
#define PACKAGE_VERSION "8.38"
|
||||
|
||||
/* to make a symbol visible */
|
||||
/* #undef PCRECPP_EXP_DECL */
|
||||
@@ -439,7 +439,7 @@ them both to 0; an emulation function will be used. */
|
||||
|
||||
/* Version number of package */
|
||||
#ifndef VERSION
|
||||
#define VERSION "8.37"
|
||||
#define VERSION "8.38"
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
@@ -451,4 +451,3 @@ them both to 0; an emulation function will be used. */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
+1076
-1052
File diff suppressed because it is too large.
Load diff
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
/* The current PCRE version information. */
|
||||
|
||||
#define PCRE_MAJOR 8
|
||||
#define PCRE_MINOR 37
|
||||
#define PCRE_MINOR 38
|
||||
#define PCRE_PRERELEASE
|
||||
#define PCRE_DATE 2015-04-28
|
||||
#define PCRE_DATE 2015-11-23
|
||||
|
||||
/* When an application links to a PCRE DLL in Windows, the symbols that are
|
||||
imported have to be identified as such. When building PCRE, the appropriate
|
||||
|
||||
+235
-99
@@ -174,7 +174,7 @@ static const short int escapes[] = {
|
||||
-ESC_Z, CHAR_LEFT_SQUARE_BRACKET,
|
||||
CHAR_BACKSLASH, CHAR_RIGHT_SQUARE_BRACKET,
|
||||
CHAR_CIRCUMFLEX_ACCENT, CHAR_UNDERSCORE,
|
||||
CHAR_GRAVE_ACCENT, 7,
|
||||
CHAR_GRAVE_ACCENT, ESC_a,
|
||||
-ESC_b, 0,
|
||||
-ESC_d, ESC_e,
|
||||
ESC_f, 0,
|
||||
@@ -202,9 +202,9 @@ static const short int escapes[] = {
|
||||
/* 68 */ 0, 0, '|', ',', '%', '_', '>', '?',
|
||||
/* 70 */ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 78 */ 0, '`', ':', '#', '@', '\'', '=', '"',
|
||||
/* 80 */ 0, 7, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0,
|
||||
/* 80 */ 0, ESC_a, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0,
|
||||
/* 88 */-ESC_h, 0, 0, '{', 0, 0, 0, 0,
|
||||
/* 90 */ 0, 0, -ESC_k, 'l', 0, ESC_n, 0, -ESC_p,
|
||||
/* 90 */ 0, 0, -ESC_k, 0, 0, ESC_n, 0, -ESC_p,
|
||||
/* 98 */ 0, ESC_r, 0, '}', 0, 0, 0, 0,
|
||||
/* A0 */ 0, '~', -ESC_s, ESC_tee, 0,-ESC_v, -ESC_w, 0,
|
||||
/* A8 */ 0,-ESC_z, 0, 0, 0, '[', 0, 0,
|
||||
@@ -219,6 +219,12 @@ static const short int escapes[] = {
|
||||
/* F0 */ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* F8 */ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/* We also need a table of characters that may follow \c in an EBCDIC
|
||||
environment for characters 0-31. */
|
||||
|
||||
static unsigned char ebcdic_escape_c[] = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -458,7 +464,7 @@ static const char error_texts[] =
|
||||
"range out of order in character class\0"
|
||||
"nothing to repeat\0"
|
||||
/* 10 */
|
||||
"operand of unlimited repeat could match the empty string\0" /** DEAD **/
|
||||
"internal error: invalid forward reference offset\0"
|
||||
"internal error: unexpected repeat\0"
|
||||
"unrecognized character after (? or (?-\0"
|
||||
"POSIX named classes are supported only within a class\0"
|
||||
@@ -527,7 +533,11 @@ static const char error_texts[] =
|
||||
"different names for subpatterns of the same number are not allowed\0"
|
||||
"(*MARK) must have an argument\0"
|
||||
"this version of PCRE is not compiled with Unicode property support\0"
|
||||
#ifndef EBCDIC
|
||||
"\\c must be followed by an ASCII character\0"
|
||||
#else
|
||||
"\\c must be followed by a letter or one of [\\]^_?\0"
|
||||
#endif
|
||||
"\\k is not followed by a braced, angle-bracketed, or quoted name\0"
|
||||
/* 70 */
|
||||
"internal error: unknown opcode in find_fixedlength()\0"
|
||||
@@ -1425,7 +1435,16 @@ else
|
||||
c ^= 0x40;
|
||||
#else /* EBCDIC coding */
|
||||
if (c >= CHAR_a && c <= CHAR_z) c += 64;
|
||||
c ^= 0xC0;
|
||||
if (c == CHAR_QUESTION_MARK)
|
||||
c = ('\\' == 188 && '`' == 74)? 0x5f : 0xff;
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
if (c == ebcdic_escape_c[i]) break;
|
||||
}
|
||||
if (i < 32) c = i; else *errorcodeptr = ERR68;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -1799,7 +1818,7 @@ for (;;)
|
||||
case OP_ASSERTBACK:
|
||||
case OP_ASSERTBACK_NOT:
|
||||
do cc += GET(cc, 1); while (*cc == OP_ALT);
|
||||
cc += PRIV(OP_lengths)[*cc];
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
/* Skip over things that don't match chars */
|
||||
@@ -2487,7 +2506,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
|
||||
if (c == OP_BRA || c == OP_BRAPOS ||
|
||||
c == OP_CBRA || c == OP_CBRAPOS ||
|
||||
c == OP_ONCE || c == OP_ONCE_NC ||
|
||||
c == OP_COND)
|
||||
c == OP_COND || c == OP_SCOND)
|
||||
{
|
||||
BOOL empty_branch;
|
||||
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */
|
||||
@@ -3886,11 +3905,11 @@ didn't consider this to be a POSIX class. Likewise for [:1234:].
|
||||
The problem in trying to be exactly like Perl is in the handling of escapes. We
|
||||
have to be sure that [abc[:x\]pqr] is *not* treated as containing a POSIX
|
||||
class, but [abc[:x\]pqr:]] is (so that an error can be generated). The code
|
||||
below handles the special case of \], but does not try to do any other escape
|
||||
processing. This makes it different from Perl for cases such as [:l\ower:]
|
||||
where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize
|
||||
"l\ower". This is a lesser evil than not diagnosing bad classes when Perl does,
|
||||
I think.
|
||||
below handles the special cases \\ and \], but does not try to do any other
|
||||
escape processing. This makes it different from Perl for cases such as
|
||||
[:l\ower:] where Perl recognizes it as the POSIX class "lower" but PCRE does
|
||||
not recognize "l\ower". This is a lesser evil than not diagnosing bad classes
|
||||
when Perl does, I think.
|
||||
|
||||
A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.
|
||||
It seems that the appearance of a nested POSIX class supersedes an apparent
|
||||
@@ -3917,21 +3936,16 @@ pcre_uchar terminator; /* Don't combine these lines; the Solaris cc */
|
||||
terminator = *(++ptr); /* compiler warns about "non-constant" initializer. */
|
||||
for (++ptr; *ptr != CHAR_NULL; ptr++)
|
||||
{
|
||||
if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
|
||||
if (*ptr == CHAR_BACKSLASH &&
|
||||
(ptr[1] == CHAR_RIGHT_SQUARE_BRACKET ||
|
||||
ptr[1] == CHAR_BACKSLASH))
|
||||
ptr++;
|
||||
else if (*ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
|
||||
else
|
||||
else if ((*ptr == CHAR_LEFT_SQUARE_BRACKET && ptr[1] == terminator) ||
|
||||
*ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
|
||||
else if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
|
||||
{
|
||||
if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
|
||||
{
|
||||
*endptr = ptr;
|
||||
return TRUE;
|
||||
}
|
||||
if (*ptr == CHAR_LEFT_SQUARE_BRACKET &&
|
||||
(ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
|
||||
ptr[1] == CHAR_EQUALS_SIGN) &&
|
||||
check_posix_syntax(ptr, endptr))
|
||||
return FALSE;
|
||||
*endptr = ptr;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
@@ -3985,11 +3999,12 @@ have their offsets adjusted. That one of the jobs of this function. Before it
|
||||
is called, the partially compiled regex must be temporarily terminated with
|
||||
OP_END.
|
||||
|
||||
This function has been extended with the possibility of forward references for
|
||||
recursions and subroutine calls. It must also check the list of such references
|
||||
for the group we are dealing with. If it finds that one of the recursions in
|
||||
the current group is on this list, it adjusts the offset in the list, not the
|
||||
value in the reference (which is a group number).
|
||||
This function has been extended to cope with forward references for recursions
|
||||
and subroutine calls. It must check the list of such references for the
|
||||
group we are dealing with. If it finds that one of the recursions in the
|
||||
current group is on this list, it does not adjust the value in the reference
|
||||
(which is a group number). After the group has been scanned, all the offsets in
|
||||
the forward reference list for the group are adjusted.
|
||||
|
||||
Arguments:
|
||||
group points to the start of the group
|
||||
@@ -4005,29 +4020,21 @@ static void
|
||||
adjust_recurse(pcre_uchar *group, int adjust, BOOL utf, compile_data *cd,
|
||||
size_t save_hwm_offset)
|
||||
{
|
||||
int offset;
|
||||
pcre_uchar *hc;
|
||||
pcre_uchar *ptr = group;
|
||||
|
||||
while ((ptr = (pcre_uchar *)find_recurse(ptr, utf)) != NULL)
|
||||
{
|
||||
int offset;
|
||||
pcre_uchar *hc;
|
||||
|
||||
/* See if this recursion is on the forward reference list. If so, adjust the
|
||||
reference. */
|
||||
|
||||
for (hc = (pcre_uchar *)cd->start_workspace + save_hwm_offset; hc < cd->hwm;
|
||||
hc += LINK_SIZE)
|
||||
{
|
||||
offset = (int)GET(hc, 0);
|
||||
if (cd->start_code + offset == ptr + 1)
|
||||
{
|
||||
PUT(hc, 0, offset + adjust);
|
||||
break;
|
||||
}
|
||||
if (cd->start_code + offset == ptr + 1) break;
|
||||
}
|
||||
|
||||
/* Otherwise, adjust the recursion offset if it's after the start of this
|
||||
group. */
|
||||
/* If we have not found this recursion on the forward reference list, adjust
|
||||
the recursion's offset if it's after the start of this group. */
|
||||
|
||||
if (hc >= cd->hwm)
|
||||
{
|
||||
@@ -4037,6 +4044,15 @@ while ((ptr = (pcre_uchar *)find_recurse(ptr, utf)) != NULL)
|
||||
|
||||
ptr += 1 + LINK_SIZE;
|
||||
}
|
||||
|
||||
/* Now adjust all forward reference offsets for the group. */
|
||||
|
||||
for (hc = (pcre_uchar *)cd->start_workspace + save_hwm_offset; hc < cd->hwm;
|
||||
hc += LINK_SIZE)
|
||||
{
|
||||
offset = (int)GET(hc, 0);
|
||||
PUT(hc, 0, offset + adjust);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4465,7 +4481,7 @@ const pcre_uchar *tempptr;
|
||||
const pcre_uchar *nestptr = NULL;
|
||||
pcre_uchar *previous = NULL;
|
||||
pcre_uchar *previous_callout = NULL;
|
||||
size_t save_hwm_offset = 0;
|
||||
size_t item_hwm_offset = 0;
|
||||
pcre_uint8 classbits[32];
|
||||
|
||||
/* We can fish out the UTF-8 setting once and for all into a BOOL, but we
|
||||
@@ -4623,8 +4639,7 @@ for (;; ptr++)
|
||||
/* In the real compile phase, just check the workspace used by the forward
|
||||
reference list. */
|
||||
|
||||
else if (cd->hwm > cd->start_workspace + cd->workspace_size -
|
||||
WORK_SIZE_SAFETY_MARGIN)
|
||||
else if (cd->hwm > cd->start_workspace + cd->workspace_size)
|
||||
{
|
||||
*errorcodeptr = ERR52;
|
||||
goto FAILED;
|
||||
@@ -4767,6 +4782,7 @@ for (;; ptr++)
|
||||
zeroreqchar = reqchar;
|
||||
zeroreqcharflags = reqcharflags;
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = ((options & PCRE_DOTALL) != 0)? OP_ALLANY: OP_ANY;
|
||||
break;
|
||||
|
||||
@@ -4818,6 +4834,7 @@ for (;; ptr++)
|
||||
/* Handle a real character class. */
|
||||
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
|
||||
/* PCRE supports POSIX class stuff inside a class. Perl gives an error if
|
||||
they are encountered at the top level, so we'll do that too. */
|
||||
@@ -4923,9 +4940,10 @@ for (;; ptr++)
|
||||
(which is on the stack). We have to remember that there was XCLASS data,
|
||||
however. */
|
||||
|
||||
if (class_uchardata > class_uchardata_base) xclass = TRUE;
|
||||
|
||||
if (lengthptr != NULL && class_uchardata > class_uchardata_base)
|
||||
{
|
||||
xclass = TRUE;
|
||||
*lengthptr += (int)(class_uchardata - class_uchardata_base);
|
||||
class_uchardata = class_uchardata_base;
|
||||
}
|
||||
@@ -5028,10 +5046,26 @@ for (;; ptr++)
|
||||
ptr = tempptr + 1;
|
||||
continue;
|
||||
|
||||
/* For all other POSIX classes, no special action is taken in UCP
|
||||
mode. Fall through to the non_UCP case. */
|
||||
/* For the other POSIX classes (ascii, xdigit) we are going to fall
|
||||
through to the non-UCP case and build a bit map for characters with
|
||||
code points less than 256. If we are in a negated POSIX class
|
||||
within a non-negated overall class, characters with code points
|
||||
greater than 255 must all match. In the special case where we have
|
||||
not yet generated any xclass data, and this is the final item in
|
||||
the overall class, we need do nothing: later on, the opcode
|
||||
OP_NCLASS will be used to indicate that characters greater than 255
|
||||
are acceptable. If we have already seen an xclass item or one may
|
||||
follow (we have to assume that it might if this is not the end of
|
||||
the class), explicitly match all wide codepoints. */
|
||||
|
||||
default:
|
||||
if (!negate_class && local_negate &&
|
||||
(xclass || tempptr[2] != CHAR_RIGHT_SQUARE_BRACKET))
|
||||
{
|
||||
*class_uchardata++ = XCL_RANGE;
|
||||
class_uchardata += PRIV(ord2utf)(0x100, class_uchardata);
|
||||
class_uchardata += PRIV(ord2utf)(0x10ffff, class_uchardata);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5195,9 +5229,9 @@ for (;; ptr++)
|
||||
cd, PRIV(vspace_list));
|
||||
continue;
|
||||
|
||||
#ifdef SUPPORT_UCP
|
||||
case ESC_p:
|
||||
case ESC_P:
|
||||
#ifdef SUPPORT_UCP
|
||||
{
|
||||
BOOL negated;
|
||||
unsigned int ptype = 0, pdata = 0;
|
||||
@@ -5211,6 +5245,9 @@ for (;; ptr++)
|
||||
class_has_8bitchar--; /* Undo! */
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
*errorcodeptr = ERR45;
|
||||
goto FAILED;
|
||||
#endif
|
||||
/* Unrecognized escapes are faulted if PCRE is running in its
|
||||
strict mode. By default, for compatibility with Perl, they are
|
||||
@@ -5367,16 +5404,20 @@ for (;; ptr++)
|
||||
CLASS_SINGLE_CHARACTER:
|
||||
if (class_one_char < 2) class_one_char++;
|
||||
|
||||
/* If class_one_char is 1, we have the first single character in the
|
||||
class, and there have been no prior ranges, or XCLASS items generated by
|
||||
escapes. If this is the final character in the class, we can optimize by
|
||||
turning the item into a 1-character OP_CHAR[I] if it's positive, or
|
||||
OP_NOT[I] if it's negative. In the positive case, it can cause firstchar
|
||||
to be set. Otherwise, there can be no first char if this item is first,
|
||||
whatever repeat count may follow. In the case of reqchar, save the
|
||||
previous value for reinstating. */
|
||||
/* If xclass_has_prop is false and class_one_char is 1, we have the first
|
||||
single character in the class, and there have been no prior ranges, or
|
||||
XCLASS items generated by escapes. If this is the final character in the
|
||||
class, we can optimize by turning the item into a 1-character OP_CHAR[I]
|
||||
if it's positive, or OP_NOT[I] if it's negative. In the positive case, it
|
||||
can cause firstchar to be set. Otherwise, there can be no first char if
|
||||
this item is first, whatever repeat count may follow. In the case of
|
||||
reqchar, save the previous value for reinstating. */
|
||||
|
||||
if (!inescq && class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
|
||||
if (!inescq &&
|
||||
#ifdef SUPPORT_UCP
|
||||
!xclass_has_prop &&
|
||||
#endif
|
||||
class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
|
||||
{
|
||||
ptr++;
|
||||
zeroreqchar = reqchar;
|
||||
@@ -5492,9 +5533,10 @@ for (;; ptr++)
|
||||
actual compiled code. */
|
||||
|
||||
#ifdef SUPPORT_UTF
|
||||
if (xclass && (!should_flip_negation || (options & PCRE_UCP) != 0))
|
||||
if (xclass && (xclass_has_prop || !should_flip_negation ||
|
||||
(options & PCRE_UCP) != 0))
|
||||
#elif !defined COMPILE_PCRE8
|
||||
if (xclass && !should_flip_negation)
|
||||
if (xclass && (xclass_has_prop || !should_flip_negation))
|
||||
#endif
|
||||
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
|
||||
{
|
||||
@@ -5930,7 +5972,7 @@ for (;; ptr++)
|
||||
{
|
||||
register int i;
|
||||
int len = (int)(code - previous);
|
||||
size_t base_hwm_offset = save_hwm_offset;
|
||||
size_t base_hwm_offset = item_hwm_offset;
|
||||
pcre_uchar *bralink = NULL;
|
||||
pcre_uchar *brazeroptr = NULL;
|
||||
|
||||
@@ -5985,7 +6027,7 @@ for (;; ptr++)
|
||||
if (repeat_max <= 1) /* Covers 0, 1, and unlimited */
|
||||
{
|
||||
*code = OP_END;
|
||||
adjust_recurse(previous, 1, utf, cd, save_hwm_offset);
|
||||
adjust_recurse(previous, 1, utf, cd, item_hwm_offset);
|
||||
memmove(previous + 1, previous, IN_UCHARS(len));
|
||||
code++;
|
||||
if (repeat_max == 0)
|
||||
@@ -6009,7 +6051,7 @@ for (;; ptr++)
|
||||
{
|
||||
int offset;
|
||||
*code = OP_END;
|
||||
adjust_recurse(previous, 2 + LINK_SIZE, utf, cd, save_hwm_offset);
|
||||
adjust_recurse(previous, 2 + LINK_SIZE, utf, cd, item_hwm_offset);
|
||||
memmove(previous + 2 + LINK_SIZE, previous, IN_UCHARS(len));
|
||||
code += 2 + LINK_SIZE;
|
||||
*previous++ = OP_BRAZERO + repeat_type;
|
||||
@@ -6254,6 +6296,12 @@ for (;; ptr++)
|
||||
while (*scode == OP_ALT);
|
||||
}
|
||||
|
||||
/* A conditional group with only one branch has an implicit empty
|
||||
alternative branch. */
|
||||
|
||||
if (*bracode == OP_COND && bracode[GET(bracode,1)] != OP_ALT)
|
||||
*bracode = OP_SCOND;
|
||||
|
||||
/* Handle possessive quantifiers. */
|
||||
|
||||
if (possessive_quantifier)
|
||||
@@ -6267,11 +6315,11 @@ for (;; ptr++)
|
||||
{
|
||||
int nlen = (int)(code - bracode);
|
||||
*code = OP_END;
|
||||
adjust_recurse(bracode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
|
||||
adjust_recurse(bracode, 1 + LINK_SIZE, utf, cd, item_hwm_offset);
|
||||
memmove(bracode + 1 + LINK_SIZE, bracode, IN_UCHARS(nlen));
|
||||
code += 1 + LINK_SIZE;
|
||||
nlen += 1 + LINK_SIZE;
|
||||
*bracode = OP_BRAPOS;
|
||||
*bracode = (*bracode == OP_COND)? OP_BRAPOS : OP_SBRAPOS;
|
||||
*code++ = OP_KETRPOS;
|
||||
PUTINC(code, 0, nlen);
|
||||
PUT(bracode, 1, nlen);
|
||||
@@ -6401,7 +6449,7 @@ for (;; ptr++)
|
||||
else
|
||||
{
|
||||
*code = OP_END;
|
||||
adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
|
||||
adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, item_hwm_offset);
|
||||
memmove(tempcode + 1 + LINK_SIZE, tempcode, IN_UCHARS(len));
|
||||
code += 1 + LINK_SIZE;
|
||||
len += 1 + LINK_SIZE;
|
||||
@@ -6450,7 +6498,7 @@ for (;; ptr++)
|
||||
|
||||
default:
|
||||
*code = OP_END;
|
||||
adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm_offset);
|
||||
adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, item_hwm_offset);
|
||||
memmove(tempcode + 1 + LINK_SIZE, tempcode, IN_UCHARS(len));
|
||||
code += 1 + LINK_SIZE;
|
||||
len += 1 + LINK_SIZE;
|
||||
@@ -6586,9 +6634,17 @@ for (;; ptr++)
|
||||
goto FAILED;
|
||||
}
|
||||
setverb = *code++ = verbs[i].op_arg;
|
||||
*code++ = arglen;
|
||||
memcpy(code, arg, IN_UCHARS(arglen));
|
||||
code += arglen;
|
||||
if (lengthptr != NULL) /* In pass 1 just add in the length */
|
||||
{ /* to avoid potential workspace */
|
||||
*lengthptr += arglen; /* overflow. */
|
||||
*code++ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*code++ = arglen;
|
||||
memcpy(code, arg, IN_UCHARS(arglen));
|
||||
code += arglen;
|
||||
}
|
||||
*code++ = 0;
|
||||
}
|
||||
|
||||
@@ -6623,7 +6679,7 @@ for (;; ptr++)
|
||||
newoptions = options;
|
||||
skipbytes = 0;
|
||||
bravalue = OP_CBRA;
|
||||
save_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
reset_bracount = FALSE;
|
||||
|
||||
/* Deal with the extended parentheses; all are introduced by '?', and the
|
||||
@@ -6641,6 +6697,7 @@ for (;; ptr++)
|
||||
/* ------------------------------------------------------------ */
|
||||
case CHAR_VERTICAL_LINE: /* Reset capture count for each branch */
|
||||
reset_bracount = TRUE;
|
||||
cd->dupgroups = TRUE; /* Record (?| encountered */
|
||||
/* Fall through */
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@@ -6741,6 +6798,12 @@ for (;; ptr++)
|
||||
{
|
||||
while (IS_DIGIT(*ptr))
|
||||
{
|
||||
if (recno > INT_MAX / 10 - 1) /* Integer overflow */
|
||||
{
|
||||
while (IS_DIGIT(*ptr)) ptr++;
|
||||
*errorcodeptr = ERR61;
|
||||
goto FAILED;
|
||||
}
|
||||
recno = recno * 10 + (int)(*ptr - CHAR_0);
|
||||
ptr++;
|
||||
}
|
||||
@@ -6769,7 +6832,7 @@ for (;; ptr++)
|
||||
ptr++;
|
||||
}
|
||||
namelen = (int)(ptr - name);
|
||||
if (lengthptr != NULL) *lengthptr += IMM2_SIZE;
|
||||
if (lengthptr != NULL) skipbytes += IMM2_SIZE;
|
||||
}
|
||||
|
||||
/* Check the terminator */
|
||||
@@ -6875,6 +6938,11 @@ for (;; ptr++)
|
||||
*errorcodeptr = ERR15;
|
||||
goto FAILED;
|
||||
}
|
||||
if (recno > INT_MAX / 10 - 1) /* Integer overflow */
|
||||
{
|
||||
*errorcodeptr = ERR61;
|
||||
goto FAILED;
|
||||
}
|
||||
recno = recno * 10 + name[i] - CHAR_0;
|
||||
}
|
||||
if (recno == 0) recno = RREF_ANY;
|
||||
@@ -7151,6 +7219,7 @@ for (;; ptr++)
|
||||
if (lengthptr != NULL)
|
||||
{
|
||||
named_group *ng;
|
||||
recno = 0;
|
||||
|
||||
if (namelen == 0)
|
||||
{
|
||||
@@ -7168,20 +7237,6 @@ for (;; ptr++)
|
||||
goto FAILED;
|
||||
}
|
||||
|
||||
/* The name table does not exist in the first pass; instead we must
|
||||
scan the list of names encountered so far in order to get the
|
||||
number. If the name is not found, set the value to 0 for a forward
|
||||
reference. */
|
||||
|
||||
ng = cd->named_groups;
|
||||
for (i = 0; i < cd->names_found; i++, ng++)
|
||||
{
|
||||
if (namelen == ng->length &&
|
||||
STRNCMP_UC_UC(name, ng->name, namelen) == 0)
|
||||
break;
|
||||
}
|
||||
recno = (i < cd->names_found)? ng->number : 0;
|
||||
|
||||
/* Count named back references. */
|
||||
|
||||
if (!is_recurse) cd->namedrefcount++;
|
||||
@@ -7191,6 +7246,56 @@ for (;; ptr++)
|
||||
16-bit data item. */
|
||||
|
||||
*lengthptr += IMM2_SIZE;
|
||||
|
||||
/* If this is a forward reference and we are within a (?|...) group,
|
||||
the reference may end up as the number of a group which we are
|
||||
currently inside, that is, it could be a recursive reference. In the
|
||||
real compile this will be picked up and the reference wrapped with
|
||||
OP_ONCE to make it atomic, so we must space in case this occurs. */
|
||||
|
||||
/* In fact, this can happen for a non-forward reference because
|
||||
another group with the same number might be created later. This
|
||||
issue is fixed "properly" in PCRE2. As PCRE1 is now in maintenance
|
||||
only mode, we finesse the bug by allowing more memory always. */
|
||||
|
||||
*lengthptr += 2 + 2*LINK_SIZE;
|
||||
|
||||
/* It is even worse than that. The current reference may be to an
|
||||
existing named group with a different number (so apparently not
|
||||
recursive) but which later on is also attached to a group with the
|
||||
current number. This can only happen if $(| has been previous
|
||||
encountered. In that case, we allow yet more memory, just in case.
|
||||
(Again, this is fixed "properly" in PCRE2. */
|
||||
|
||||
if (cd->dupgroups) *lengthptr += 4 + 4*LINK_SIZE;
|
||||
|
||||
/* Otherwise, check for recursion here. The name table does not exist
|
||||
in the first pass; instead we must scan the list of names encountered
|
||||
so far in order to get the number. If the name is not found, leave
|
||||
the value of recno as 0 for a forward reference. */
|
||||
|
||||
else
|
||||
{
|
||||
ng = cd->named_groups;
|
||||
for (i = 0; i < cd->names_found; i++, ng++)
|
||||
{
|
||||
if (namelen == ng->length &&
|
||||
STRNCMP_UC_UC(name, ng->name, namelen) == 0)
|
||||
{
|
||||
open_capitem *oc;
|
||||
recno = ng->number;
|
||||
if (is_recurse) break;
|
||||
for (oc = cd->open_caps; oc != NULL; oc = oc->next)
|
||||
{
|
||||
if (oc->number == recno)
|
||||
{
|
||||
oc->flag = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In the real compile, search the name table. We check the name
|
||||
@@ -7237,8 +7342,6 @@ for (;; ptr++)
|
||||
for (i++; i < cd->names_found; i++)
|
||||
{
|
||||
if (STRCMP_UC_UC(slot + IMM2_SIZE, cslot + IMM2_SIZE) != 0) break;
|
||||
|
||||
|
||||
count++;
|
||||
cslot += cd->name_entry_size;
|
||||
}
|
||||
@@ -7247,6 +7350,7 @@ for (;; ptr++)
|
||||
{
|
||||
if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = ((options & PCRE_CASELESS) != 0)? OP_DNREFI : OP_DNREF;
|
||||
PUT2INC(code, 0, index);
|
||||
PUT2INC(code, 0, count);
|
||||
@@ -7284,9 +7388,14 @@ for (;; ptr++)
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
case CHAR_R: /* Recursion */
|
||||
ptr++; /* Same as (?0) */
|
||||
/* Fall through */
|
||||
case CHAR_R: /* Recursion, same as (?0) */
|
||||
recno = 0;
|
||||
if (*(++ptr) != CHAR_RIGHT_PARENTHESIS)
|
||||
{
|
||||
*errorcodeptr = ERR29;
|
||||
goto FAILED;
|
||||
}
|
||||
goto HANDLE_RECURSION;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@@ -7323,7 +7432,15 @@ for (;; ptr++)
|
||||
|
||||
recno = 0;
|
||||
while(IS_DIGIT(*ptr))
|
||||
{
|
||||
if (recno > INT_MAX / 10 - 1) /* Integer overflow */
|
||||
{
|
||||
while (IS_DIGIT(*ptr)) ptr++;
|
||||
*errorcodeptr = ERR61;
|
||||
goto FAILED;
|
||||
}
|
||||
recno = recno * 10 + *ptr++ - CHAR_0;
|
||||
}
|
||||
|
||||
if (*ptr != (pcre_uchar)terminator)
|
||||
{
|
||||
@@ -7360,6 +7477,7 @@ for (;; ptr++)
|
||||
HANDLE_RECURSION:
|
||||
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
called = cd->start_code;
|
||||
|
||||
/* When we are actually compiling, find the bracket that is being
|
||||
@@ -7561,7 +7679,11 @@ for (;; ptr++)
|
||||
previous = NULL;
|
||||
cd->iscondassert = FALSE;
|
||||
}
|
||||
else previous = code;
|
||||
else
|
||||
{
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
}
|
||||
|
||||
*code = bravalue;
|
||||
tempcode = code;
|
||||
@@ -7809,7 +7931,7 @@ for (;; ptr++)
|
||||
const pcre_uchar *p;
|
||||
pcre_uint32 cf;
|
||||
|
||||
save_hwm_offset = cd->hwm - cd->start_workspace; /* Normally this is set when '(' is read */
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace; /* Normally this is set when '(' is read */
|
||||
terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
|
||||
CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
|
||||
|
||||
@@ -7838,7 +7960,7 @@ for (;; ptr++)
|
||||
if (*p != (pcre_uchar)terminator)
|
||||
{
|
||||
*errorcodeptr = ERR57;
|
||||
break;
|
||||
goto FAILED;
|
||||
}
|
||||
ptr++;
|
||||
goto HANDLE_NUMERICAL_RECURSION;
|
||||
@@ -7853,7 +7975,7 @@ for (;; ptr++)
|
||||
ptr[1] != CHAR_APOSTROPHE && ptr[1] != CHAR_LEFT_CURLY_BRACKET))
|
||||
{
|
||||
*errorcodeptr = ERR69;
|
||||
break;
|
||||
goto FAILED;
|
||||
}
|
||||
is_recurse = FALSE;
|
||||
terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
|
||||
@@ -7877,6 +7999,7 @@ for (;; ptr++)
|
||||
HANDLE_REFERENCE:
|
||||
if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
|
||||
PUT2INC(code, 0, recno);
|
||||
cd->backref_map |= (recno < 32)? (1 << recno) : 1;
|
||||
@@ -7906,6 +8029,7 @@ for (;; ptr++)
|
||||
if (!get_ucp(&ptr, &negated, &ptype, &pdata, errorcodeptr))
|
||||
goto FAILED;
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = ((escape == ESC_p) != negated)? OP_PROP : OP_NOTPROP;
|
||||
*code++ = ptype;
|
||||
*code++ = pdata;
|
||||
@@ -7946,6 +8070,7 @@ for (;; ptr++)
|
||||
|
||||
{
|
||||
previous = (escape > ESC_b && escape < ESC_Z)? code : NULL;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = (!utf && escape == ESC_C)? OP_ALLANY : escape;
|
||||
}
|
||||
}
|
||||
@@ -7989,6 +8114,7 @@ for (;; ptr++)
|
||||
|
||||
ONE_CHAR:
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
|
||||
/* For caseless UTF-8 mode when UCP support is available, check whether
|
||||
this character has more than one other case. If so, generate a special
|
||||
@@ -9164,6 +9290,7 @@ cd->names_found = 0;
|
||||
cd->name_entry_size = 0;
|
||||
cd->name_table = NULL;
|
||||
cd->dupnames = FALSE;
|
||||
cd->dupgroups = FALSE;
|
||||
cd->namedrefcount = 0;
|
||||
cd->start_code = cworkspace;
|
||||
cd->hwm = cworkspace;
|
||||
@@ -9336,6 +9463,16 @@ if (cd->hwm > cd->start_workspace)
|
||||
int offset, recno;
|
||||
cd->hwm -= LINK_SIZE;
|
||||
offset = GET(cd->hwm, 0);
|
||||
|
||||
/* Check that the hwm handling hasn't gone wrong. This whole area is
|
||||
rewritten in PCRE2 because there are some obscure cases. */
|
||||
|
||||
if (offset == 0 || codestart[offset-1] != OP_RECURSE)
|
||||
{
|
||||
errorcode = ERR10;
|
||||
break;
|
||||
}
|
||||
|
||||
recno = GET(codestart, offset);
|
||||
if (recno != prev_recno)
|
||||
{
|
||||
@@ -9366,7 +9503,7 @@ used in this code because at least one compiler gives a warning about loss of
|
||||
"const" attribute if the cast (pcre_uchar *)codestart is used directly in the
|
||||
function call. */
|
||||
|
||||
if ((options & PCRE_NO_AUTO_POSSESS) == 0)
|
||||
if (errorcode == 0 && (options & PCRE_NO_AUTO_POSSESS) == 0)
|
||||
{
|
||||
pcre_uchar *temp = (pcre_uchar *)codestart;
|
||||
auto_possessify(temp, utf, cd);
|
||||
@@ -9380,7 +9517,7 @@ OP_RECURSE that are not fixed length get a diagnosic with a useful offset. The
|
||||
exceptional ones forgo this. We scan the pattern to check that they are fixed
|
||||
length, and set their lengths. */
|
||||
|
||||
if (cd->check_lookbehind)
|
||||
if (errorcode == 0 && cd->check_lookbehind)
|
||||
{
|
||||
pcre_uchar *cc = (pcre_uchar *)codestart;
|
||||
|
||||
@@ -9593,4 +9730,3 @@ return (pcre32 *)re;
|
||||
}
|
||||
|
||||
/* End of pcre_compile.c */
|
||||
|
||||
@@ -688,7 +688,7 @@ the alternative names that are used. */
|
||||
#define foc number
|
||||
#define save_mark data
|
||||
|
||||
/* These statements are here to stop the compiler complaining about uninitialized
|
||||
/* These statements are here to stop the compiler complaining about unitialized
|
||||
variables. */
|
||||
|
||||
#ifdef SUPPORT_UCP
|
||||
@@ -6685,7 +6685,8 @@ if (md->offset_vector != NULL)
|
||||
register int *iend = iptr - re->top_bracket;
|
||||
if (iend < md->offset_vector + 2) iend = md->offset_vector + 2;
|
||||
while (--iptr >= iend) *iptr = -1;
|
||||
md->offset_vector[0] = md->offset_vector[1] = -1;
|
||||
if (offsetcount > 0) md->offset_vector[0] = -1;
|
||||
if (offsetcount > 1) md->offset_vector[1] = -1;
|
||||
}
|
||||
|
||||
/* Set up the first character to match, if available. The first_char value is
|
||||
|
||||
@@ -988,7 +988,7 @@ other. NOTE: The values also appear in pcre_jit_compile.c. */
|
||||
#ifndef EBCDIC
|
||||
|
||||
#define HSPACE_LIST \
|
||||
CHAR_HT, CHAR_SPACE, 0xa0, \
|
||||
CHAR_HT, CHAR_SPACE, CHAR_NBSP, \
|
||||
0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, \
|
||||
0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202f, 0x205f, 0x3000, \
|
||||
NOTACHAR
|
||||
@@ -1014,7 +1014,7 @@ other. NOTE: The values also appear in pcre_jit_compile.c. */
|
||||
#define HSPACE_BYTE_CASES \
|
||||
case CHAR_HT: \
|
||||
case CHAR_SPACE: \
|
||||
case 0xa0 /* NBSP */
|
||||
case CHAR_NBSP
|
||||
|
||||
#define HSPACE_CASES \
|
||||
HSPACE_BYTE_CASES: \
|
||||
@@ -1041,11 +1041,12 @@ other. NOTE: The values also appear in pcre_jit_compile.c. */
|
||||
/* ------ EBCDIC environments ------ */
|
||||
|
||||
#else
|
||||
#define HSPACE_LIST CHAR_HT, CHAR_SPACE
|
||||
#define HSPACE_LIST CHAR_HT, CHAR_SPACE, CHAR_NBSP, NOTACHAR
|
||||
|
||||
#define HSPACE_BYTE_CASES \
|
||||
case CHAR_HT: \
|
||||
case CHAR_SPACE
|
||||
case CHAR_SPACE: \
|
||||
case CHAR_NBSP
|
||||
|
||||
#define HSPACE_CASES HSPACE_BYTE_CASES
|
||||
|
||||
@@ -1219,6 +1220,7 @@ same code point. */
|
||||
|
||||
#define CHAR_ESC '\047'
|
||||
#define CHAR_DEL '\007'
|
||||
#define CHAR_NBSP '\x41'
|
||||
#define STR_ESC "\047"
|
||||
#define STR_DEL "\007"
|
||||
|
||||
@@ -1233,6 +1235,7 @@ a positive value. */
|
||||
#define CHAR_NEL ((unsigned char)'\x85')
|
||||
#define CHAR_ESC '\033'
|
||||
#define CHAR_DEL '\177'
|
||||
#define CHAR_NBSP ((unsigned char)'\xa0')
|
||||
|
||||
#define STR_LF "\n"
|
||||
#define STR_NL STR_LF
|
||||
@@ -1610,6 +1613,7 @@ only. */
|
||||
#define CHAR_VERTICAL_LINE '\174'
|
||||
#define CHAR_RIGHT_CURLY_BRACKET '\175'
|
||||
#define CHAR_TILDE '\176'
|
||||
#define CHAR_NBSP ((unsigned char)'\xa0')
|
||||
|
||||
#define STR_HT "\011"
|
||||
#define STR_VT "\013"
|
||||
@@ -1766,6 +1770,10 @@ only. */
|
||||
|
||||
/* Escape items that are just an encoding of a particular data value. */
|
||||
|
||||
#ifndef ESC_a
|
||||
#define ESC_a CHAR_BEL
|
||||
#endif
|
||||
|
||||
#ifndef ESC_e
|
||||
#define ESC_e CHAR_ESC
|
||||
#endif
|
||||
@@ -2450,6 +2458,7 @@ typedef struct compile_data {
|
||||
BOOL had_pruneorskip; /* (*PRUNE) or (*SKIP) encountered */
|
||||
BOOL check_lookbehind; /* Lookbehinds need later checking */
|
||||
BOOL dupnames; /* Duplicate names exist */
|
||||
BOOL dupgroups; /* Duplicate groups exist: (?| found */
|
||||
BOOL iscondassert; /* Next assert is a condition */
|
||||
int nltype; /* Newline type */
|
||||
int nllen; /* Newline string length */
|
||||
|
||||
@@ -1064,6 +1064,7 @@ pcre_uchar *alternative;
|
||||
pcre_uchar *end = NULL;
|
||||
int private_data_ptr = *private_data_start;
|
||||
int space, size, bracketlen;
|
||||
BOOL repeat_check = TRUE;
|
||||
|
||||
while (cc < ccend)
|
||||
{
|
||||
@@ -1071,9 +1072,10 @@ while (cc < ccend)
|
||||
size = 0;
|
||||
bracketlen = 0;
|
||||
if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE)
|
||||
return;
|
||||
break;
|
||||
|
||||
if (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND)
|
||||
if (repeat_check && (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND))
|
||||
{
|
||||
if (detect_repeat(common, cc))
|
||||
{
|
||||
/* These brackets are converted to repeats, so no global
|
||||
@@ -1081,6 +1083,8 @@ while (cc < ccend)
|
||||
if (cc >= end)
|
||||
end = bracketend(cc);
|
||||
}
|
||||
}
|
||||
repeat_check = TRUE;
|
||||
|
||||
switch(*cc)
|
||||
{
|
||||
@@ -1136,6 +1140,13 @@ while (cc < ccend)
|
||||
bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_BRAZERO:
|
||||
case OP_BRAMINZERO:
|
||||
case OP_BRAPOSZERO:
|
||||
repeat_check = FALSE;
|
||||
size = 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_1
|
||||
space = 1;
|
||||
size = -2;
|
||||
@@ -1162,12 +1173,17 @@ while (cc < ccend)
|
||||
size = 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
|
||||
case OP_TYPEUPTO:
|
||||
if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
|
||||
space = 2;
|
||||
size = 1 + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_TYPEMINUPTO:
|
||||
space = 2;
|
||||
size = 1 + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_CLASS:
|
||||
case OP_NCLASS:
|
||||
size += 1 + 32 / sizeof(pcre_uchar);
|
||||
@@ -1316,6 +1332,13 @@ while (cc < ccend)
|
||||
cc += 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_THEN:
|
||||
stack_restore = TRUE;
|
||||
if (common->control_head_ptr != 0)
|
||||
*needs_control_head = TRUE;
|
||||
cc ++;
|
||||
break;
|
||||
|
||||
default:
|
||||
stack_restore = TRUE;
|
||||
/* Fall through. */
|
||||
@@ -2220,6 +2243,7 @@ while (current != NULL)
|
||||
SLJIT_ASSERT_STOP();
|
||||
break;
|
||||
}
|
||||
SLJIT_ASSERT(current > (sljit_sw*)current[-1]);
|
||||
current = (sljit_sw*)current[-1];
|
||||
}
|
||||
return -1;
|
||||
@@ -3209,7 +3233,7 @@ bytes[len] = byte;
|
||||
bytes[0] = len;
|
||||
}
|
||||
|
||||
static int scan_prefix(compiler_common *common, pcre_uchar *cc, pcre_uint32 *chars, pcre_uint8 *bytes, int max_chars)
|
||||
static int scan_prefix(compiler_common *common, pcre_uchar *cc, pcre_uint32 *chars, pcre_uint8 *bytes, int max_chars, pcre_uint32 *rec_count)
|
||||
{
|
||||
/* Recursive function, which scans prefix literals. */
|
||||
BOOL last, any, caseless;
|
||||
@@ -3227,9 +3251,14 @@ pcre_uchar othercase[1];
|
||||
repeat = 1;
|
||||
while (TRUE)
|
||||
{
|
||||
if (*rec_count == 0)
|
||||
return 0;
|
||||
(*rec_count)--;
|
||||
|
||||
last = TRUE;
|
||||
any = FALSE;
|
||||
caseless = FALSE;
|
||||
|
||||
switch (*cc)
|
||||
{
|
||||
case OP_CHARI:
|
||||
@@ -3291,7 +3320,7 @@ while (TRUE)
|
||||
#ifdef SUPPORT_UTF
|
||||
if (common->utf && HAS_EXTRALEN(*cc)) len += GET_EXTRALEN(*cc);
|
||||
#endif
|
||||
max_chars = scan_prefix(common, cc + len, chars, bytes, max_chars);
|
||||
max_chars = scan_prefix(common, cc + len, chars, bytes, max_chars, rec_count);
|
||||
if (max_chars == 0)
|
||||
return consumed;
|
||||
last = FALSE;
|
||||
@@ -3314,7 +3343,7 @@ while (TRUE)
|
||||
alternative = cc + GET(cc, 1);
|
||||
while (*alternative == OP_ALT)
|
||||
{
|
||||
max_chars = scan_prefix(common, alternative + 1 + LINK_SIZE, chars, bytes, max_chars);
|
||||
max_chars = scan_prefix(common, alternative + 1 + LINK_SIZE, chars, bytes, max_chars, rec_count);
|
||||
if (max_chars == 0)
|
||||
return consumed;
|
||||
alternative += GET(alternative, 1);
|
||||
@@ -3556,6 +3585,7 @@ int i, max, from;
|
||||
int range_right = -1, range_len = 3 - 1;
|
||||
sljit_ub *update_table = NULL;
|
||||
BOOL in_range;
|
||||
pcre_uint32 rec_count;
|
||||
|
||||
for (i = 0; i < MAX_N_CHARS; i++)
|
||||
{
|
||||
@@ -3564,7 +3594,8 @@ for (i = 0; i < MAX_N_CHARS; i++)
|
||||
bytes[i * MAX_N_BYTES] = 0;
|
||||
}
|
||||
|
||||
max = scan_prefix(common, common->start, chars, bytes, MAX_N_CHARS);
|
||||
rec_count = 10000;
|
||||
max = scan_prefix(common, common->start, chars, bytes, MAX_N_CHARS, &rec_count);
|
||||
|
||||
if (max <= 1)
|
||||
return FALSE;
|
||||
@@ -4311,8 +4342,10 @@ switch(length)
|
||||
case 4:
|
||||
if ((ranges[1] - ranges[0]) == (ranges[3] - ranges[2])
|
||||
&& (ranges[0] | (ranges[2] - ranges[0])) == ranges[2]
|
||||
&& (ranges[1] & (ranges[2] - ranges[0])) == 0
|
||||
&& is_powerof2(ranges[2] - ranges[0]))
|
||||
{
|
||||
SLJIT_ASSERT((ranges[0] & (ranges[2] - ranges[0])) == 0 && (ranges[2] & ranges[3] & (ranges[2] - ranges[0])) != 0);
|
||||
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[0]);
|
||||
if (ranges[2] + 1 != ranges[3])
|
||||
{
|
||||
@@ -4900,9 +4933,10 @@ else if ((cc[-1] & XCL_MAP) != 0)
|
||||
if (!check_class_ranges(common, (const pcre_uint8 *)cc, FALSE, TRUE, list))
|
||||
{
|
||||
#ifdef COMPILE_PCRE8
|
||||
SLJIT_ASSERT(common->utf);
|
||||
jump = NULL;
|
||||
if (common->utf)
|
||||
#endif
|
||||
jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
|
||||
jump = CMP(SLJIT_GREATER, TMP1, 0, SLJIT_IMM, 255);
|
||||
|
||||
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
|
||||
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
|
||||
@@ -4911,7 +4945,10 @@ else if ((cc[-1] & XCL_MAP) != 0)
|
||||
OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
|
||||
add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
|
||||
|
||||
JUMPHERE(jump);
|
||||
#ifdef COMPILE_PCRE8
|
||||
if (common->utf)
|
||||
#endif
|
||||
JUMPHERE(jump);
|
||||
}
|
||||
|
||||
OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
|
||||
@@ -5219,7 +5256,7 @@ while (*cc != XCL_END)
|
||||
OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
|
||||
|
||||
SET_CHAR_OFFSET(0);
|
||||
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xff);
|
||||
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
|
||||
OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
|
||||
|
||||
SET_TYPE_OFFSET(ucp_Pc);
|
||||
@@ -7665,6 +7702,10 @@ while (*cc != OP_KETRPOS)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
|
||||
}
|
||||
|
||||
/* Even if the match is empty, we need to reset the control head. */
|
||||
if (needs_control_head)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack));
|
||||
|
||||
if (opcode == OP_SBRAPOS || opcode == OP_SCBRAPOS)
|
||||
add_jump(compiler, &emptymatch, CMP(SLJIT_EQUAL, TMP1, 0, STR_PTR, 0));
|
||||
|
||||
@@ -7692,6 +7733,10 @@ while (*cc != OP_KETRPOS)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw), STR_PTR, 0);
|
||||
}
|
||||
|
||||
/* Even if the match is empty, we need to reset the control head. */
|
||||
if (needs_control_head)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack));
|
||||
|
||||
if (opcode == OP_SBRAPOS || opcode == OP_SCBRAPOS)
|
||||
add_jump(compiler, &emptymatch, CMP(SLJIT_EQUAL, TMP1, 0, STR_PTR, 0));
|
||||
|
||||
@@ -7704,9 +7749,6 @@ while (*cc != OP_KETRPOS)
|
||||
}
|
||||
}
|
||||
|
||||
if (needs_control_head)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack));
|
||||
|
||||
JUMPTO(SLJIT_JUMP, loop);
|
||||
flush_stubs(common);
|
||||
|
||||
@@ -8441,8 +8483,7 @@ while (cc < ccend)
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), STR_PTR, 0);
|
||||
}
|
||||
BACKTRACK_AS(braminzero_backtrack)->matchingpath = LABEL();
|
||||
if (cc[1] > OP_ASSERTBACK_NOT)
|
||||
count_match(common);
|
||||
count_match(common);
|
||||
break;
|
||||
|
||||
case OP_ONCE:
|
||||
@@ -9624,7 +9665,7 @@ static SLJIT_INLINE void compile_recurse(compiler_common *common)
|
||||
DEFINE_COMPILER;
|
||||
pcre_uchar *cc = common->start + common->currententry->start;
|
||||
pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);
|
||||
pcre_uchar *ccend = bracketend(cc);
|
||||
pcre_uchar *ccend = bracketend(cc) - (1 + LINK_SIZE);
|
||||
BOOL needs_control_head;
|
||||
int framesize = get_framesize(common, cc, NULL, TRUE, &needs_control_head);
|
||||
int private_data_size = get_private_data_copy_length(common, ccbegin, ccend, needs_control_head);
|
||||
@@ -9648,6 +9689,7 @@ set_jumps(common->currententry->calls, common->currententry->entry);
|
||||
|
||||
sljit_emit_fast_enter(compiler, TMP2, 0);
|
||||
allocate_stack(common, private_data_size + framesize + alternativesize);
|
||||
count_match(common);
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0);
|
||||
copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
|
||||
if (needs_control_head)
|
||||
@@ -9992,6 +10034,7 @@ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
|
||||
OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match));
|
||||
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base));
|
||||
OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit));
|
||||
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
|
||||
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH, TMP1, 0);
|
||||
|
||||
if (mode == JIT_PARTIAL_SOFT_COMPILE)
|
||||
|
||||
@@ -71,6 +71,7 @@ Arguments:
|
||||
startcode pointer to start of the whole pattern's code
|
||||
options the compiling options
|
||||
recurses chain of recurse_check to catch mutual recursion
|
||||
countptr pointer to call count (to catch over complexity)
|
||||
|
||||
Returns: the minimum length
|
||||
-1 if \C in UTF-8 mode or (*ACCEPT) was encountered
|
||||
@@ -80,7 +81,8 @@ Returns: the minimum length
|
||||
|
||||
static int
|
||||
find_minlength(const REAL_PCRE *re, const pcre_uchar *code,
|
||||
const pcre_uchar *startcode, int options, recurse_check *recurses)
|
||||
const pcre_uchar *startcode, int options, recurse_check *recurses,
|
||||
int *countptr)
|
||||
{
|
||||
int length = -1;
|
||||
/* PCRE_UTF16 has the same value as PCRE_UTF8. */
|
||||
@@ -90,6 +92,8 @@ recurse_check this_recurse;
|
||||
register int branchlength = 0;
|
||||
register pcre_uchar *cc = (pcre_uchar *)code + 1 + LINK_SIZE;
|
||||
|
||||
if ((*countptr)++ > 1000) return -1; /* too complex */
|
||||
|
||||
if (*code == OP_CBRA || *code == OP_SCBRA ||
|
||||
*code == OP_CBRAPOS || *code == OP_SCBRAPOS) cc += IMM2_SIZE;
|
||||
|
||||
@@ -131,7 +135,7 @@ for (;;)
|
||||
case OP_SBRAPOS:
|
||||
case OP_ONCE:
|
||||
case OP_ONCE_NC:
|
||||
d = find_minlength(re, cc, startcode, options, recurses);
|
||||
d = find_minlength(re, cc, startcode, options, recurses, countptr);
|
||||
if (d < 0) return d;
|
||||
branchlength += d;
|
||||
do cc += GET(cc, 1); while (*cc == OP_ALT);
|
||||
@@ -415,7 +419,8 @@ for (;;)
|
||||
int dd;
|
||||
this_recurse.prev = recurses;
|
||||
this_recurse.group = cs;
|
||||
dd = find_minlength(re, cs, startcode, options, &this_recurse);
|
||||
dd = find_minlength(re, cs, startcode, options, &this_recurse,
|
||||
countptr);
|
||||
if (dd < d) d = dd;
|
||||
}
|
||||
}
|
||||
@@ -451,7 +456,8 @@ for (;;)
|
||||
{
|
||||
this_recurse.prev = recurses;
|
||||
this_recurse.group = cs;
|
||||
d = find_minlength(re, cs, startcode, options, &this_recurse);
|
||||
d = find_minlength(re, cs, startcode, options, &this_recurse,
|
||||
countptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,7 +520,7 @@ for (;;)
|
||||
this_recurse.prev = recurses;
|
||||
this_recurse.group = cs;
|
||||
branchlength += find_minlength(re, cs, startcode, options,
|
||||
&this_recurse);
|
||||
&this_recurse, countptr);
|
||||
}
|
||||
}
|
||||
cc += 1 + LINK_SIZE;
|
||||
@@ -1453,6 +1459,7 @@ pcre32_study(const pcre32 *external_re, int options, const char **errorptr)
|
||||
#endif
|
||||
{
|
||||
int min;
|
||||
int count = 0;
|
||||
BOOL bits_set = FALSE;
|
||||
pcre_uint8 start_bits[32];
|
||||
PUBL(extra) *extra = NULL;
|
||||
@@ -1539,7 +1546,7 @@ if ((re->options & PCRE_ANCHORED) == 0 &&
|
||||
|
||||
/* Find the minimum length of subject string. */
|
||||
|
||||
switch(min = find_minlength(re, code, code, re->options, NULL))
|
||||
switch(min = find_minlength(re, code, code, re->options, NULL, &count))
|
||||
{
|
||||
case -2: *errorptr = "internal error: missing capturing bracket"; return NULL;
|
||||
case -3: *errorptr = "internal error: opcode not recognized"; return NULL;
|
||||
|
||||
@@ -246,7 +246,7 @@ while ((t = *data++) != XCL_END)
|
||||
|
||||
case PT_PXPUNCT:
|
||||
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_P ||
|
||||
(c < 256 && PRIV(ucp_gentype)[prop->chartype] == ucp_S)) == isprop)
|
||||
(c < 128 && PRIV(ucp_gentype)[prop->chartype] == ucp_S)) == isprop)
|
||||
return !negated;
|
||||
break;
|
||||
|
||||
|
||||
@@ -96,6 +96,15 @@
|
||||
#define SLJIT_EXECUTABLE_ALLOCATOR 1
|
||||
#endif
|
||||
|
||||
/* Force cdecl calling convention even if a better calling
|
||||
convention (e.g. fastcall) is supported by the C compiler.
|
||||
If this option is enabled, C functions without
|
||||
SLJIT_CALL can also be called from JIT code. */
|
||||
#ifndef SLJIT_USE_CDECL_CALLING_CONVENTION
|
||||
/* Disabled by default */
|
||||
#define SLJIT_USE_CDECL_CALLING_CONVENTION 0
|
||||
#endif
|
||||
|
||||
/* Return with error when an invalid argument is passed. */
|
||||
#ifndef SLJIT_ARGUMENT_CHECKS
|
||||
/* Disabled by default */
|
||||
|
||||
@@ -468,7 +468,12 @@ typedef double sljit_d;
|
||||
|
||||
#ifndef SLJIT_CALL
|
||||
|
||||
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
|
||||
#if (defined SLJIT_USE_CDECL_CALLING_CONVENTION && SLJIT_USE_CDECL_CALLING_CONVENTION)
|
||||
|
||||
/* Force cdecl. */
|
||||
#define SLJIT_CALL
|
||||
|
||||
#elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
|
||||
|
||||
#if defined(__GNUC__) && !defined(__APPLE__)
|
||||
|
||||
@@ -608,6 +613,12 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void);
|
||||
#define SLJIT_LOCALS_OFFSET_BASE ((23 + 1) * sizeof(sljit_sw))
|
||||
#endif
|
||||
|
||||
#elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
|
||||
|
||||
#define SLJIT_NUMBER_OF_REGISTERS 10
|
||||
#define SLJIT_NUMBER_OF_SAVED_REGISTERS 5
|
||||
#define SLJIT_LOCALS_OFFSET_BASE 0
|
||||
|
||||
#elif (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
|
||||
|
||||
#define SLJIT_NUMBER_OF_REGISTERS 0
|
||||
|
||||
@@ -845,8 +845,8 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *comp
|
||||
}
|
||||
|
||||
static SLJIT_CONST char* op0_names[] = {
|
||||
(char*)"breakpoint", (char*)"nop",
|
||||
(char*)"lumul", (char*)"lsmul", (char*)"ludiv", (char*)"lsdiv",
|
||||
(char*)"breakpoint", (char*)"nop", (char*)"lumul", (char*)"lsmul",
|
||||
(char*)"udivmod", (char*)"sdivmod", (char*)"udivi", (char*)"sdivi"
|
||||
};
|
||||
|
||||
static SLJIT_CONST char* op1_names[] = {
|
||||
@@ -1036,7 +1036,7 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler
|
||||
{
|
||||
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
|
||||
CHECK_ARGUMENT((op >= SLJIT_BREAKPOINT && op <= SLJIT_LSMUL)
|
||||
|| ((op & ~SLJIT_INT_OP) >= SLJIT_LUDIV && (op & ~SLJIT_INT_OP) <= SLJIT_LSDIV));
|
||||
|| ((op & ~SLJIT_INT_OP) >= SLJIT_UDIVMOD && (op & ~SLJIT_INT_OP) <= SLJIT_SDIVI));
|
||||
CHECK_ARGUMENT(op < SLJIT_LUMUL || compiler->scratches >= 2);
|
||||
#endif
|
||||
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
|
||||
@@ -1447,6 +1447,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_flags(struct sljit_com
|
||||
|
||||
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
|
||||
{
|
||||
SLJIT_UNUSED_ARG(offset);
|
||||
|
||||
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
|
||||
FUNCTION_CHECK_DST(dst, dstw);
|
||||
#endif
|
||||
@@ -1462,6 +1464,8 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_co
|
||||
|
||||
static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
|
||||
{
|
||||
SLJIT_UNUSED_ARG(init_value);
|
||||
|
||||
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
|
||||
FUNCTION_CHECK_DST(dst, dstw);
|
||||
#endif
|
||||
|
||||
@@ -687,7 +687,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
|
||||
#define SLJIT_OP0_BASE 0
|
||||
|
||||
/* Flags: - (never set any flags)
|
||||
Note: breakpoint instruction is not supported by all architectures (namely ppc)
|
||||
Note: breakpoint instruction is not supported by all architectures (e.g. ppc)
|
||||
It falls back to SLJIT_NOP in those cases. */
|
||||
#define SLJIT_BREAKPOINT (SLJIT_OP0_BASE + 0)
|
||||
/* Flags: - (never set any flags)
|
||||
@@ -696,24 +696,42 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *
|
||||
#define SLJIT_NOP (SLJIT_OP0_BASE + 1)
|
||||
/* Flags: - (may destroy flags)
|
||||
Unsigned multiplication of SLJIT_R0 and SLJIT_R1.
|
||||
Result goes to SLJIT_R1:SLJIT_R0 (high:low) word */
|
||||
Result is placed into SLJIT_R1:SLJIT_R0 (high:low) word */
|
||||
#define SLJIT_LUMUL (SLJIT_OP0_BASE + 2)
|
||||
/* Flags: - (may destroy flags)
|
||||
Signed multiplication of SLJIT_R0 and SLJIT_R1.
|
||||
Result goes to SLJIT_R1:SLJIT_R0 (high:low) word */
|
||||
Result is placed into SLJIT_R1:SLJIT_R0 (high:low) word */
|
||||
#define SLJIT_LSMUL (SLJIT_OP0_BASE + 3)
|
||||
/* Flags: I - (may destroy flags)
|
||||
Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
|
||||
The result is placed in SLJIT_R0 and the remainder goes to SLJIT_R1.
|
||||
Note: if SLJIT_R1 contains 0, the behaviour is undefined. */
|
||||
#define SLJIT_LUDIV (SLJIT_OP0_BASE + 4)
|
||||
#define SLJIT_ILUDIV (SLJIT_LUDIV | SLJIT_INT_OP)
|
||||
The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
|
||||
Note: if SLJIT_R1 is 0, the behaviour is undefined. */
|
||||
#define SLJIT_UDIVMOD (SLJIT_OP0_BASE + 4)
|
||||
#define SLJIT_IUDIVMOD (SLJIT_UDIVMOD | SLJIT_INT_OP)
|
||||
/* Flags: I - (may destroy flags)
|
||||
Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
|
||||
The result is placed in SLJIT_R0 and the remainder goes to SLJIT_R1.
|
||||
Note: if SLJIT_R1 contains 0, the behaviour is undefined. */
|
||||
#define SLJIT_LSDIV (SLJIT_OP0_BASE + 5)
|
||||
#define SLJIT_ILSDIV (SLJIT_LSDIV | SLJIT_INT_OP)
|
||||
The result is placed into SLJIT_R0 and the remainder into SLJIT_R1.
|
||||
Note: if SLJIT_R1 is 0, the behaviour is undefined.
|
||||
Note: if SLJIT_R1 is -1 and SLJIT_R0 is integer min (0x800..00),
|
||||
the behaviour is undefined. */
|
||||
#define SLJIT_SDIVMOD (SLJIT_OP0_BASE + 5)
|
||||
#define SLJIT_ISDIVMOD (SLJIT_SDIVMOD | SLJIT_INT_OP)
|
||||
/* Flags: I - (may destroy flags)
|
||||
Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1.
|
||||
The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
|
||||
Note: if SLJIT_R1 is 0, the behaviour is undefined.
|
||||
Note: SLJIT_SDIV is single precision divide. */
|
||||
#define SLJIT_UDIVI (SLJIT_OP0_BASE + 6)
|
||||
#define SLJIT_IUDIVI (SLJIT_UDIVI | SLJIT_INT_OP)
|
||||
/* Flags: I - (may destroy flags)
|
||||
Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1.
|
||||
The result is placed into SLJIT_R0. SLJIT_R1 preserves its value.
|
||||
Note: if SLJIT_R1 is 0, the behaviour is undefined.
|
||||
Note: if SLJIT_R1 is -1 and SLJIT_R0 is integer min (0x800..00),
|
||||
the behaviour is undefined.
|
||||
Note: SLJIT_SDIV is single precision divide. */
|
||||
#define SLJIT_SDIVI (SLJIT_OP0_BASE + 7)
|
||||
#define SLJIT_ISDIVI (SLJIT_SDIVI | SLJIT_INT_OP)
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op);
|
||||
|
||||
@@ -851,34 +869,6 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
|
||||
sljit_si src1, sljit_sw src1w,
|
||||
sljit_si src2, sljit_sw src2w);
|
||||
|
||||
/* The following function is a helper function for sljit_emit_op_custom.
|
||||
It returns with the real machine register index ( >=0 ) of any SLJIT_R,
|
||||
SLJIT_S and SLJIT_SP registers.
|
||||
|
||||
Note: it returns with -1 for virtual registers (only on x86-32). */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg);
|
||||
|
||||
/* The following function is a helper function for sljit_emit_op_custom.
|
||||
It returns with the real machine register index of any SLJIT_FLOAT register.
|
||||
|
||||
Note: the index is always an even number on ARM (except ARM-64), MIPS, and SPARC. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg);
|
||||
|
||||
/* Any instruction can be inserted into the instruction stream by
|
||||
sljit_emit_op_custom. It has a similar purpose as inline assembly.
|
||||
The size parameter must match to the instruction size of the target
|
||||
architecture:
|
||||
|
||||
x86: 0 < size <= 15. The instruction argument can be byte aligned.
|
||||
Thumb2: if size == 2, the instruction argument must be 2 byte aligned.
|
||||
if size == 4, the instruction argument must be 4 byte aligned.
|
||||
Otherwise: size must be 4 and instruction argument must be 4 byte aligned. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
|
||||
void *instruction, sljit_si size);
|
||||
|
||||
/* Returns with non-zero if fpu is available. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void);
|
||||
@@ -1196,4 +1186,64 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct
|
||||
|
||||
#endif /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* CPU specific functions */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
/* The following function is a helper function for sljit_emit_op_custom.
|
||||
It returns with the real machine register index ( >=0 ) of any SLJIT_R,
|
||||
SLJIT_S and SLJIT_SP registers.
|
||||
|
||||
Note: it returns with -1 for virtual registers (only on x86-32). */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg);
|
||||
|
||||
/* The following function is a helper function for sljit_emit_op_custom.
|
||||
It returns with the real machine register index of any SLJIT_FLOAT register.
|
||||
|
||||
Note: the index is always an even number on ARM (except ARM-64), MIPS, and SPARC. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg);
|
||||
|
||||
/* Any instruction can be inserted into the instruction stream by
|
||||
sljit_emit_op_custom. It has a similar purpose as inline assembly.
|
||||
The size parameter must match to the instruction size of the target
|
||||
architecture:
|
||||
|
||||
x86: 0 < size <= 15. The instruction argument can be byte aligned.
|
||||
Thumb2: if size == 2, the instruction argument must be 2 byte aligned.
|
||||
if size == 4, the instruction argument must be 4 byte aligned.
|
||||
Otherwise: size must be 4 and instruction argument must be 4 byte aligned. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
|
||||
void *instruction, sljit_si size);
|
||||
|
||||
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
|
||||
|
||||
/* Returns with non-zero if sse2 is available. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_sse2_available(void);
|
||||
|
||||
/* Returns with non-zero if cmov instruction is available. */
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_cmov_available(void);
|
||||
|
||||
/* Emit a conditional mov instruction on x86 CPUs. This instruction
|
||||
moves src to destination, if the condition is satisfied. Unlike
|
||||
other arithmetic instructions, destination must be a register.
|
||||
Before such instructions are emitted, cmov support should be
|
||||
checked by sljit_x86_is_cmov_available function.
|
||||
type must be between SLJIT_EQUAL and SLJIT_S_ORDERED
|
||||
dst_reg must be a valid register and it can be combined
|
||||
with SLJIT_INT_OP to perform 32 bit arithmetic
|
||||
Flags: I - (never set any flags)
|
||||
*/
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_emit_cmov(struct sljit_compiler *compiler,
|
||||
sljit_si type,
|
||||
sljit_si dst_reg,
|
||||
sljit_si src, sljit_sw srcw);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SLJIT_LIR_H_ */
|
||||
@@ -1833,18 +1833,33 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
| (reg_map[SLJIT_R0] << 8)
|
||||
| reg_map[TMP_REG1]);
|
||||
#endif
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
if (compiler->scratches >= 3)
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
|
||||
SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2, bad_register_mapping);
|
||||
|
||||
if ((op >= SLJIT_UDIVI) && (compiler->scratches >= 3)) {
|
||||
FAIL_IF(push_inst(compiler, 0xe52d2008 /* str r2, [sp, #-8]! */));
|
||||
FAIL_IF(push_inst(compiler, 0xe58d1004 /* str r1, [sp, #4] */));
|
||||
}
|
||||
else if ((op >= SLJIT_UDIVI) || (compiler->scratches >= 3))
|
||||
FAIL_IF(push_inst(compiler, 0xe52d0008 | (op >= SLJIT_UDIVI ? 0x1000 : 0x2000) /* str r1/r2, [sp, #-8]! */));
|
||||
|
||||
#if defined(__GNUC__)
|
||||
FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
|
||||
(op == SLJIT_LUDIV ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
|
||||
((op | 0x2) == SLJIT_UDIVI ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
|
||||
#else
|
||||
#error "Software divmod functions are needed"
|
||||
#endif
|
||||
if (compiler->scratches >= 3)
|
||||
return push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */);
|
||||
|
||||
if ((op >= SLJIT_UDIVI) && (compiler->scratches >= 3)) {
|
||||
FAIL_IF(push_inst(compiler, 0xe59d1004 /* ldr r1, [sp, #4] */));
|
||||
FAIL_IF(push_inst(compiler, 0xe49d2008 /* ldr r2, [sp], #8 */));
|
||||
}
|
||||
else if ((op >= SLJIT_UDIVI) || (compiler->scratches >= 3))
|
||||
return push_inst(compiler, 0xe49d0008 | (op >= SLJIT_UDIVI ? 0x1000 : 0x2000) /* ldr r1/r2, [sp], #8 */);
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,14 +1087,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
|
||||
saved_regs_size += sizeof(sljit_sw);
|
||||
}
|
||||
local_size -= saved_regs_size + SLJIT_LOCALS_OFFSET;
|
||||
FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | (saved_regs_size << 10)));
|
||||
if (saved_regs_size > 0)
|
||||
FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | (saved_regs_size << 10)));
|
||||
}
|
||||
|
||||
tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
|
||||
prev = -1;
|
||||
for (i = SLJIT_S0; i >= tmp; i--) {
|
||||
if (prev == -1) {
|
||||
prev = i;
|
||||
if (!(offs & (1 << 15))) {
|
||||
prev = i;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, STRI | RT(i) | RN(TMP_SP) | (offs >> 5)));
|
||||
offs += 1 << 15;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, STP | RT(prev) | RT2(i) | RN(TMP_SP) | offs));
|
||||
@@ -1104,7 +1110,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
|
||||
|
||||
for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
|
||||
if (prev == -1) {
|
||||
prev = i;
|
||||
if (!(offs & (1 << 15))) {
|
||||
prev = i;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, STRI | RT(i) | RN(TMP_SP) | (offs >> 5)));
|
||||
offs += 1 << 15;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, STP | RT(prev) | RT2(i) | RN(TMP_SP) | offs));
|
||||
@@ -1112,8 +1123,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
|
||||
prev = -1;
|
||||
}
|
||||
|
||||
if (prev != -1)
|
||||
FAIL_IF(push_inst(compiler, STRI | RT(prev) | RN(TMP_SP) | (offs >> 5)));
|
||||
SLJIT_ASSERT(prev == -1);
|
||||
|
||||
if (compiler->local_size > (63 * sizeof(sljit_sw))) {
|
||||
/* The local_size is already adjusted by the saved registers. */
|
||||
@@ -1188,7 +1198,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
|
||||
prev = -1;
|
||||
for (i = SLJIT_S0; i >= tmp; i--) {
|
||||
if (prev == -1) {
|
||||
prev = i;
|
||||
if (!(offs & (1 << 15))) {
|
||||
prev = i;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, LDRI | RT(i) | RN(TMP_SP) | (offs >> 5)));
|
||||
offs += 1 << 15;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, LDP | RT(prev) | RT2(i) | RN(TMP_SP) | offs));
|
||||
@@ -1198,7 +1213,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
|
||||
|
||||
for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
|
||||
if (prev == -1) {
|
||||
prev = i;
|
||||
if (!(offs & (1 << 15))) {
|
||||
prev = i;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, LDRI | RT(i) | RN(TMP_SP) | (offs >> 5)));
|
||||
offs += 1 << 15;
|
||||
continue;
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, LDP | RT(prev) | RT2(i) | RN(TMP_SP) | offs));
|
||||
@@ -1206,13 +1226,12 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
|
||||
prev = -1;
|
||||
}
|
||||
|
||||
if (prev != -1)
|
||||
FAIL_IF(push_inst(compiler, LDRI | RT(prev) | RN(TMP_SP) | (offs >> 5)));
|
||||
SLJIT_ASSERT(prev == -1);
|
||||
|
||||
if (compiler->local_size <= (63 * sizeof(sljit_sw))) {
|
||||
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
|
||||
| RN(TMP_SP) | (((local_size >> 3) & 0x7f) << 15)));
|
||||
} else {
|
||||
} else if (saved_regs_size > 0) {
|
||||
FAIL_IF(push_inst(compiler, ADDI | RD(TMP_SP) | RN(TMP_SP) | (saved_regs_size << 10)));
|
||||
}
|
||||
|
||||
@@ -1242,12 +1261,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
FAIL_IF(push_inst(compiler, ORR | RD(TMP_REG1) | RN(TMP_ZERO) | RM(SLJIT_R0)));
|
||||
FAIL_IF(push_inst(compiler, MADD | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1) | RT2(TMP_ZERO)));
|
||||
return push_inst(compiler, (op == SLJIT_LUMUL ? UMULH : SMULH) | RD(SLJIT_R1) | RN(TMP_REG1) | RM(SLJIT_R1));
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
FAIL_IF(push_inst(compiler, (ORR ^ inv_bits) | RD(TMP_REG1) | RN(TMP_ZERO) | RM(SLJIT_R0)));
|
||||
FAIL_IF(push_inst(compiler, ((op == SLJIT_LUDIV ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, ((op == SLJIT_UDIVMOD ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, (MADD ^ inv_bits) | RD(SLJIT_R1) | RN(SLJIT_R0) | RM(SLJIT_R1) | RT2(TMP_ZERO)));
|
||||
return push_inst(compiler, (SUB ^ inv_bits) | RD(SLJIT_R1) | RN(TMP_REG1) | RM(SLJIT_R1));
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
return push_inst(compiler, ((op == SLJIT_UDIVI ? UDIV : SDIV) ^ inv_bits) | RD(SLJIT_R0) | RN(SLJIT_R0) | RM(SLJIT_R1));
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
@@ -1239,6 +1239,9 @@ extern int __aeabi_idivmod(int numerator, int denominator);
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
|
||||
{
|
||||
sljit_sw saved_reg_list[3];
|
||||
sljit_sw saved_reg_count;
|
||||
|
||||
CHECK_ERROR();
|
||||
CHECK(check_sljit_emit_op0(compiler, op));
|
||||
|
||||
@@ -1255,24 +1258,53 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
| (reg_map[SLJIT_R0] << 12)
|
||||
| (reg_map[SLJIT_R0] << 16)
|
||||
| reg_map[SLJIT_R1]);
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
if (compiler->scratches >= 4) {
|
||||
FAIL_IF(push_inst32(compiler, 0xf84d2d04 /* str r2, [sp, #-4]! */));
|
||||
FAIL_IF(push_inst32(compiler, 0xf84dcd04 /* str ip, [sp, #-4]! */));
|
||||
} else if (compiler->scratches >= 3)
|
||||
FAIL_IF(push_inst32(compiler, 0xf84d2d08 /* str r2, [sp, #-8]! */));
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
|
||||
SLJIT_COMPILE_ASSERT(reg_map[2] == 1 && reg_map[3] == 2 && reg_map[4] == 12, bad_register_mapping);
|
||||
|
||||
saved_reg_count = 0;
|
||||
if (compiler->scratches >= 4)
|
||||
saved_reg_list[saved_reg_count++] = 12;
|
||||
if (compiler->scratches >= 3)
|
||||
saved_reg_list[saved_reg_count++] = 2;
|
||||
if (op >= SLJIT_UDIVI)
|
||||
saved_reg_list[saved_reg_count++] = 1;
|
||||
|
||||
if (saved_reg_count > 0) {
|
||||
FAIL_IF(push_inst32(compiler, 0xf84d0d00 | (saved_reg_count >= 3 ? 16 : 8)
|
||||
| (saved_reg_list[0] << 12) /* str rX, [sp, #-8/-16]! */));
|
||||
if (saved_reg_count >= 2) {
|
||||
SLJIT_ASSERT(saved_reg_list[1] < 8);
|
||||
FAIL_IF(push_inst16(compiler, 0x9001 | (saved_reg_list[1] << 8) /* str rX, [sp, #4] */));
|
||||
}
|
||||
if (saved_reg_count >= 3) {
|
||||
SLJIT_ASSERT(saved_reg_list[2] < 8);
|
||||
FAIL_IF(push_inst16(compiler, 0x9002 | (saved_reg_list[2] << 8) /* str rX, [sp, #8] */));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
|
||||
(op == SLJIT_LUDIV ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
|
||||
((op | 0x2) == SLJIT_UDIVI ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
|
||||
#else
|
||||
#error "Software divmod functions are needed"
|
||||
#endif
|
||||
if (compiler->scratches >= 4) {
|
||||
FAIL_IF(push_inst32(compiler, 0xf85dcb04 /* ldr ip, [sp], #4 */));
|
||||
return push_inst32(compiler, 0xf85d2b04 /* ldr r2, [sp], #4 */);
|
||||
} else if (compiler->scratches >= 3)
|
||||
return push_inst32(compiler, 0xf85d2b08 /* ldr r2, [sp], #8 */);
|
||||
|
||||
if (saved_reg_count > 0) {
|
||||
if (saved_reg_count >= 3) {
|
||||
SLJIT_ASSERT(saved_reg_list[2] < 8);
|
||||
FAIL_IF(push_inst16(compiler, 0x9802 | (saved_reg_list[2] << 8) /* ldr rX, [sp, #8] */));
|
||||
}
|
||||
if (saved_reg_count >= 2) {
|
||||
SLJIT_ASSERT(saved_reg_list[1] < 8);
|
||||
FAIL_IF(push_inst16(compiler, 0x9801 | (saved_reg_list[1] << 8) /* ldr rX, [sp, #4] */));
|
||||
}
|
||||
return push_inst32(compiler, 0xf85d0b00 | (saved_reg_count >= 3 ? 16 : 8)
|
||||
| (saved_reg_list[0] << 12) /* ldr rX, [sp], #8/16 */);
|
||||
}
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,8 +1053,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
#endif
|
||||
FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
|
||||
return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
|
||||
#if !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1)
|
||||
FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
|
||||
FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
|
||||
@@ -1062,15 +1065,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
|
||||
#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
|
||||
if (int_op)
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
else
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
#else
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1), MOVABLE_INS));
|
||||
#endif
|
||||
|
||||
FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0)));
|
||||
return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
|
||||
return (op >= SLJIT_UDIVI) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1));
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
@@ -1267,22 +1267,23 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
FAIL_IF(push_inst(compiler, MULLW | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
|
||||
return push_inst(compiler, (op == SLJIT_LUMUL ? MULHWU : MULHW) | D(SLJIT_R1) | A(TMP_REG1) | B(SLJIT_R1));
|
||||
#endif
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
FAIL_IF(push_inst(compiler, OR | S(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R0)));
|
||||
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
|
||||
if (int_op) {
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DIVWU : DIVW) | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, MULLW | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
} else {
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DIVDU : DIVD) | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, MULLD | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
}
|
||||
return push_inst(compiler, SUBF | D(SLJIT_R1) | A(SLJIT_R1) | B(TMP_REG1));
|
||||
FAIL_IF(push_inst(compiler, (int_op ? (op == SLJIT_UDIVMOD ? DIVWU : DIVW) : (op == SLJIT_UDIVMOD ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, (int_op ? MULLW : MULLD) | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
#else
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? DIVWU : DIVW) | D(SLJIT_R0) | A(TMP_REG1) | B(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_UDIVMOD ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, MULLW | D(SLJIT_R1) | A(SLJIT_R0) | B(SLJIT_R1)));
|
||||
#endif
|
||||
return push_inst(compiler, SUBF | D(SLJIT_R1) | A(SLJIT_R1) | B(TMP_REG1));
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
|
||||
return push_inst(compiler, (int_op ? (op == SLJIT_UDIVI ? DIVWU : DIVW) : (op == SLJIT_UDIVI ? DIVDU : DIVD)) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
|
||||
#else
|
||||
return push_inst(compiler, (op == SLJIT_UDIVI ? DIVWU : DIVW) | D(SLJIT_R0) | A(SLJIT_R0) | B(SLJIT_R1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -777,20 +777,25 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
#else
|
||||
#error "Implementation required"
|
||||
#endif
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
|
||||
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
|
||||
if (op == SLJIT_LUDIV)
|
||||
if ((op | 0x2) == SLJIT_UDIVI)
|
||||
FAIL_IF(push_inst(compiler, WRY | S1(0), MOVABLE_INS));
|
||||
else {
|
||||
FAIL_IF(push_inst(compiler, SRA | D(TMP_REG1) | S1(SLJIT_R0) | IMM(31), DR(TMP_REG1)));
|
||||
FAIL_IF(push_inst(compiler, WRY | S1(TMP_REG1), MOVABLE_INS));
|
||||
}
|
||||
FAIL_IF(push_inst(compiler, OR | D(TMP_REG2) | S1(0) | S2(SLJIT_R0), DR(TMP_REG2)));
|
||||
FAIL_IF(push_inst(compiler, (op == SLJIT_LUDIV ? UDIV : SDIV) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
|
||||
if (op <= SLJIT_SDIVMOD)
|
||||
FAIL_IF(push_inst(compiler, OR | D(TMP_REG2) | S1(0) | S2(SLJIT_R0), DR(TMP_REG2)));
|
||||
FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_UDIVI ? UDIV : SDIV) | D(SLJIT_R0) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R0)));
|
||||
if (op >= SLJIT_UDIVI)
|
||||
return SLJIT_SUCCESS;
|
||||
FAIL_IF(push_inst(compiler, SMUL | D(SLJIT_R1) | S1(SLJIT_R0) | S2(SLJIT_R1), DR(SLJIT_R1)));
|
||||
FAIL_IF(push_inst(compiler, SUB | D(SLJIT_R1) | S1(TMP_REG2) | S2(SLJIT_R1), DR(SLJIT_R1)));
|
||||
return SLJIT_SUCCESS;
|
||||
return push_inst(compiler, SUB | D(SLJIT_R1) | S1(TMP_REG2) | S2(SLJIT_R1), DR(SLJIT_R1));
|
||||
#else
|
||||
#error "Implementation required"
|
||||
#endif
|
||||
|
||||
@@ -35,21 +35,21 @@
|
||||
#define SIMM_16BIT_MIN (-0x8000)
|
||||
#define SIMM_17BIT_MAX (0xffff)
|
||||
#define SIMM_17BIT_MIN (-0x10000)
|
||||
#define SIMM_32BIT_MIN (-0x80000000)
|
||||
#define SIMM_32BIT_MAX (0x7fffffff)
|
||||
#define SIMM_48BIT_MIN (0x800000000000L)
|
||||
#define SIMM_32BIT_MIN (-0x7fffffff - 1)
|
||||
#define SIMM_48BIT_MAX (0x7fffffff0000L)
|
||||
#define SIMM_48BIT_MIN (-0x800000000000L)
|
||||
#define IMM16(imm) ((imm) & 0xffff)
|
||||
|
||||
#define UIMM_16BIT_MAX (0xffff)
|
||||
|
||||
#define TMP_REG1 (SLJIT_NO_REGISTERS + 1)
|
||||
#define TMP_REG2 (SLJIT_NO_REGISTERS + 2)
|
||||
#define TMP_REG3 (SLJIT_NO_REGISTERS + 3)
|
||||
#define ADDR_TMP (SLJIT_NO_REGISTERS + 4)
|
||||
#define TMP_REG1 (SLJIT_NUMBER_OF_REGISTERS + 2)
|
||||
#define TMP_REG2 (SLJIT_NUMBER_OF_REGISTERS + 3)
|
||||
#define TMP_REG3 (SLJIT_NUMBER_OF_REGISTERS + 4)
|
||||
#define ADDR_TMP (SLJIT_NUMBER_OF_REGISTERS + 5)
|
||||
#define PIC_ADDR_REG TMP_REG2
|
||||
|
||||
static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 5] = {
|
||||
static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 6] = {
|
||||
63, 0, 1, 2, 3, 4, 30, 31, 32, 33, 34, 54, 5, 16, 6, 7
|
||||
};
|
||||
|
||||
@@ -58,11 +58,6 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 5] = {
|
||||
#define TMP_REG2_mapped 16
|
||||
#define TMP_REG3_mapped 6
|
||||
#define ADDR_TMP_mapped 7
|
||||
#define SLJIT_SAVED_REG1_mapped 30
|
||||
#define SLJIT_SAVED_REG2_mapped 31
|
||||
#define SLJIT_SAVED_REG3_mapped 32
|
||||
#define SLJIT_SAVED_EREG1_mapped 33
|
||||
#define SLJIT_SAVED_EREG2_mapped 34
|
||||
|
||||
/* Flags are keept in volatile registers. */
|
||||
#define EQUAL_FLAG 8
|
||||
@@ -399,6 +394,9 @@ static sljit_si push_inst(struct sljit_compiler *compiler, sljit_ins ins)
|
||||
#define SUB(dst, srca, srcb) \
|
||||
push_3_buffer(compiler, TILEGX_OPC_SUB, dst, srca, srcb, __LINE__)
|
||||
|
||||
#define MUL(dst, srca, srcb) \
|
||||
push_3_buffer(compiler, TILEGX_OPC_MULX, dst, srca, srcb, __LINE__)
|
||||
|
||||
#define NOR(dst, srca, srcb) \
|
||||
push_3_buffer(compiler, TILEGX_OPC_NOR, dst, srca, srcb, __LINE__)
|
||||
|
||||
@@ -547,8 +545,8 @@ const struct Format* compute_format()
|
||||
|
||||
const struct Format* match = NULL;
|
||||
const struct Format *b = NULL;
|
||||
unsigned int i = 0;
|
||||
for (i; i < sizeof formats / sizeof formats[0]; i++) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof formats / sizeof formats[0]; i++) {
|
||||
b = &formats[i];
|
||||
if ((b->pipe_mask & compatible_pipes) == b->pipe_mask) {
|
||||
match = b;
|
||||
@@ -625,7 +623,6 @@ tilegx_bundle_bits get_bundle_bit(struct jit_instr *inst)
|
||||
|
||||
static sljit_si update_buffer(struct sljit_compiler *compiler)
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
int orig_index = inst_buf_index;
|
||||
struct jit_instr inst0 = inst_buf[0];
|
||||
@@ -738,8 +735,10 @@ static sljit_si update_buffer(struct sljit_compiler *compiler)
|
||||
|
||||
static sljit_si flush_buffer(struct sljit_compiler *compiler)
|
||||
{
|
||||
while (inst_buf_index != 0)
|
||||
update_buffer(compiler);
|
||||
while (inst_buf_index != 0) {
|
||||
FAIL_IF(update_buffer(compiler));
|
||||
}
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
static sljit_si push_4_buffer(struct sljit_compiler *compiler, tilegx_mnemonic opc, int op0, int op1, int op2, int op3, int line)
|
||||
@@ -787,6 +786,7 @@ static sljit_si push_3_buffer(struct sljit_compiler *compiler, tilegx_mnemonic o
|
||||
case TILEGX_OPC_ADD:
|
||||
case TILEGX_OPC_AND:
|
||||
case TILEGX_OPC_SUB:
|
||||
case TILEGX_OPC_MULX:
|
||||
case TILEGX_OPC_OR:
|
||||
case TILEGX_OPC_XOR:
|
||||
case TILEGX_OPC_NOR:
|
||||
@@ -905,7 +905,6 @@ static SLJIT_INLINE sljit_ins * detect_jump_type(struct sljit_jump *jump, sljit_
|
||||
sljit_sw diff;
|
||||
sljit_uw target_addr;
|
||||
sljit_ins *inst;
|
||||
sljit_ins saved_inst;
|
||||
|
||||
if (jump->flags & SLJIT_REWRITABLE_JUMP)
|
||||
return code_ptr;
|
||||
@@ -1009,7 +1008,7 @@ SLJIT_API_FUNC_ATTRIBUTE void * sljit_generate_code(struct sljit_compiler *compi
|
||||
struct sljit_const *const_;
|
||||
|
||||
CHECK_ERROR_PTR();
|
||||
check_sljit_generate_code(compiler);
|
||||
CHECK_PTR(check_sljit_generate_code(compiler));
|
||||
reverse_buf(compiler);
|
||||
|
||||
code = (sljit_ins *)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins));
|
||||
@@ -1178,13 +1177,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
|
||||
sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
|
||||
{
|
||||
sljit_ins base;
|
||||
sljit_ins bundle = 0;
|
||||
|
||||
sljit_si i, tmp;
|
||||
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
|
||||
CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
|
||||
set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
|
||||
|
||||
local_size += (saveds + 1) * sizeof(sljit_sw);
|
||||
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
|
||||
local_size = (local_size + 7) & ~7;
|
||||
compiler->local_size = local_size;
|
||||
|
||||
@@ -1200,56 +1199,52 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
|
||||
local_size = 0;
|
||||
}
|
||||
|
||||
/* Save the return address. */
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 8));
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, RA, -8));
|
||||
|
||||
if (saveds >= 1)
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, SLJIT_SAVED_REG1_mapped, -8));
|
||||
/* Save the S registers. */
|
||||
tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
|
||||
for (i = SLJIT_S0; i >= tmp; i--) {
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, reg_map[i], -8));
|
||||
}
|
||||
|
||||
if (saveds >= 2)
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, SLJIT_SAVED_REG2_mapped, -8));
|
||||
/* Save the R registers that need to be reserved. */
|
||||
for (i = scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, reg_map[i], -8));
|
||||
}
|
||||
|
||||
if (saveds >= 3)
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, SLJIT_SAVED_REG3_mapped, -8));
|
||||
|
||||
if (saveds >= 4)
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, SLJIT_SAVED_EREG1_mapped, -8));
|
||||
|
||||
if (saveds >= 5)
|
||||
FAIL_IF(ST_ADD(ADDR_TMP_mapped, SLJIT_SAVED_EREG2_mapped, -8));
|
||||
|
||||
if (args >= 1)
|
||||
FAIL_IF(ADD(SLJIT_SAVED_REG1_mapped, 0, ZERO));
|
||||
|
||||
if (args >= 2)
|
||||
FAIL_IF(ADD(SLJIT_SAVED_REG2_mapped, 1, ZERO));
|
||||
|
||||
if (args >= 3)
|
||||
FAIL_IF(ADD(SLJIT_SAVED_REG3_mapped, 2, ZERO));
|
||||
/* Move the arguments to S registers. */
|
||||
for (i = 0; i < args; i++) {
|
||||
FAIL_IF(ADD(reg_map[SLJIT_S0 - i], i, ZERO));
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_set_context(struct sljit_compiler *compiler,
|
||||
sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
|
||||
sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
|
||||
{
|
||||
CHECK_ERROR_VOID();
|
||||
check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
|
||||
CHECK_ERROR();
|
||||
CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
|
||||
set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
|
||||
|
||||
local_size += (saveds + 1) * sizeof(sljit_sw);
|
||||
local_size += GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
|
||||
compiler->local_size = (local_size + 7) & ~7;
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
|
||||
{
|
||||
sljit_si local_size;
|
||||
sljit_ins base;
|
||||
int addr_initialized = 0;
|
||||
sljit_si i, tmp;
|
||||
sljit_si saveds;
|
||||
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_return(compiler, op, src, srcw);
|
||||
CHECK(check_sljit_emit_return(compiler, op, src, srcw));
|
||||
|
||||
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
|
||||
|
||||
@@ -1263,50 +1258,20 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compi
|
||||
local_size = 0;
|
||||
}
|
||||
|
||||
/* Restore the return address. */
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 8));
|
||||
FAIL_IF(LD(RA, ADDR_TMP_mapped));
|
||||
FAIL_IF(LD_ADD(RA, ADDR_TMP_mapped, -8));
|
||||
|
||||
if (compiler->saveds >= 5) {
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 48));
|
||||
addr_initialized = 1;
|
||||
|
||||
FAIL_IF(LD_ADD(SLJIT_SAVED_EREG2_mapped, ADDR_TMP_mapped, 8));
|
||||
/* Restore the S registers. */
|
||||
saveds = compiler->saveds;
|
||||
tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
|
||||
for (i = SLJIT_S0; i >= tmp; i--) {
|
||||
FAIL_IF(LD_ADD(reg_map[i], ADDR_TMP_mapped, -8));
|
||||
}
|
||||
|
||||
if (compiler->saveds >= 4) {
|
||||
if (addr_initialized == 0) {
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 40));
|
||||
addr_initialized = 1;
|
||||
}
|
||||
|
||||
FAIL_IF(LD_ADD(SLJIT_SAVED_EREG1_mapped, ADDR_TMP_mapped, 8));
|
||||
}
|
||||
|
||||
if (compiler->saveds >= 3) {
|
||||
if (addr_initialized == 0) {
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 32));
|
||||
addr_initialized = 1;
|
||||
}
|
||||
|
||||
FAIL_IF(LD_ADD(SLJIT_SAVED_REG3_mapped, ADDR_TMP_mapped, 8));
|
||||
}
|
||||
|
||||
if (compiler->saveds >= 2) {
|
||||
if (addr_initialized == 0) {
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 24));
|
||||
addr_initialized = 1;
|
||||
}
|
||||
|
||||
FAIL_IF(LD_ADD(SLJIT_SAVED_REG2_mapped, ADDR_TMP_mapped, 8));
|
||||
}
|
||||
|
||||
if (compiler->saveds >= 1) {
|
||||
if (addr_initialized == 0) {
|
||||
FAIL_IF(ADDLI(ADDR_TMP_mapped, base, local_size - 16));
|
||||
/* addr_initialized = 1; no need to initialize as it's the last one. */
|
||||
}
|
||||
|
||||
FAIL_IF(LD_ADD(SLJIT_SAVED_REG1_mapped, ADDR_TMP_mapped, 8));
|
||||
/* Restore the R registers that need to be reserved. */
|
||||
for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) {
|
||||
FAIL_IF(LD_ADD(reg_map[i], ADDR_TMP_mapped, -8));
|
||||
}
|
||||
|
||||
if (compiler->local_size <= SIMM_16BIT_MAX)
|
||||
@@ -1585,7 +1550,7 @@ static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
|
||||
{
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_fast_enter(compiler, dst, dstw);
|
||||
CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
|
||||
ADJUST_LOCAL_OFFSET(dst, dstw);
|
||||
|
||||
/* For UNUSED dst. Uncommon, but possible. */
|
||||
@@ -1602,7 +1567,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *c
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
|
||||
{
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_fast_return(compiler, src, srcw);
|
||||
CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
|
||||
ADJUST_LOCAL_OFFSET(src, srcw);
|
||||
|
||||
if (FAST_IS_REG(src))
|
||||
@@ -1636,9 +1601,11 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
if (op == SLJIT_MOV_SI)
|
||||
return BFEXTS(reg_map[dst], reg_map[src2], 0, 31);
|
||||
|
||||
return BFEXTU(reg_map[dst], reg_map[src2], 0, 31);
|
||||
} else if (dst != src2)
|
||||
SLJIT_ASSERT_STOP();
|
||||
return BFEXTU(reg_map[dst], reg_map[src2], 0, 31);
|
||||
} else if (dst != src2) {
|
||||
SLJIT_ASSERT(src2 == 0);
|
||||
return ADD(reg_map[dst], reg_map[src2], ZERO);
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
@@ -1650,8 +1617,10 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
return BFEXTS(reg_map[dst], reg_map[src2], 0, 7);
|
||||
|
||||
return BFEXTU(reg_map[dst], reg_map[src2], 0, 7);
|
||||
} else if (dst != src2)
|
||||
SLJIT_ASSERT_STOP();
|
||||
} else if (dst != src2) {
|
||||
SLJIT_ASSERT(src2 == 0);
|
||||
return ADD(reg_map[dst], reg_map[src2], ZERO);
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
@@ -1663,8 +1632,10 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
return BFEXTS(reg_map[dst], reg_map[src2], 0, 15);
|
||||
|
||||
return BFEXTU(reg_map[dst], reg_map[src2], 0, 15);
|
||||
} else if (dst != src2)
|
||||
SLJIT_ASSERT_STOP();
|
||||
} else if (dst != src2) {
|
||||
SLJIT_ASSERT(src2 == 0);
|
||||
return ADD(reg_map[dst], reg_map[src2], ZERO);
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
@@ -1811,7 +1782,6 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
else {
|
||||
/* Rare ocasion. */
|
||||
FAIL_IF(ADD(TMP_EREG2, reg_map[src1], ZERO));
|
||||
|
||||
overflow_ra = TMP_EREG2;
|
||||
}
|
||||
}
|
||||
@@ -1903,6 +1873,17 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
case SLJIT_MUL:
|
||||
if (flags & SRC2_IMM) {
|
||||
FAIL_IF(load_immediate(compiler, TMP_REG2_mapped, src2));
|
||||
src2 = TMP_REG2;
|
||||
flags &= ~SRC2_IMM;
|
||||
}
|
||||
|
||||
FAIL_IF(MUL(reg_map[dst], reg_map[src1], reg_map[src2]));
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
#define EMIT_LOGICAL(op_imm, op_norm) \
|
||||
if (flags & SRC2_IMM) { \
|
||||
FAIL_IF(load_immediate(compiler, ADDR_TMP_mapped, src2)); \
|
||||
@@ -1950,8 +1931,8 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
|
||||
} else { \
|
||||
if (op & SLJIT_SET_E) \
|
||||
FAIL_IF(push_3_buffer( \
|
||||
compiler, op_imm, reg_map[dst], reg_map[src1], \
|
||||
src2 & 0x3F, __LINE__)); \
|
||||
compiler, op_norm, EQUAL_FLAG, reg_map[src1], \
|
||||
reg_map[src2], __LINE__)); \
|
||||
if (CHECK_FLAGS(SLJIT_SET_E)) \
|
||||
FAIL_IF(push_3_buffer( \
|
||||
compiler, op_norm, reg_map[dst], reg_map[src1], \
|
||||
@@ -2105,66 +2086,61 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
|
||||
{
|
||||
sljit_si sugg_dst_ar, dst_ar;
|
||||
sljit_si flags = GET_ALL_FLAGS(op);
|
||||
sljit_si mem_type = (op & SLJIT_INT_OP) ? (INT_DATA | SIGNED_DATA) : WORD_DATA;
|
||||
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type);
|
||||
CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type));
|
||||
ADJUST_LOCAL_OFFSET(dst, dstw);
|
||||
|
||||
if (dst == SLJIT_UNUSED)
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
op = GET_OPCODE(op);
|
||||
if (op == SLJIT_MOV_SI || op == SLJIT_MOV_UI)
|
||||
mem_type = INT_DATA | SIGNED_DATA;
|
||||
sugg_dst_ar = reg_map[(op < SLJIT_ADD && FAST_IS_REG(dst)) ? dst : TMP_REG2];
|
||||
|
||||
compiler->cache_arg = 0;
|
||||
compiler->cache_argw = 0;
|
||||
if (op >= SLJIT_ADD && (src & SLJIT_MEM)) {
|
||||
ADJUST_LOCAL_OFFSET(src, srcw);
|
||||
FAIL_IF(emit_op_mem2(compiler, WORD_DATA | LOAD_DATA, TMP_REG1_mapped, src, srcw, dst, dstw));
|
||||
FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, TMP_REG1_mapped, src, srcw, dst, dstw));
|
||||
src = TMP_REG1;
|
||||
srcw = 0;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SLJIT_C_EQUAL:
|
||||
case SLJIT_C_NOT_EQUAL:
|
||||
switch (type & 0xff) {
|
||||
case SLJIT_EQUAL:
|
||||
case SLJIT_NOT_EQUAL:
|
||||
FAIL_IF(CMPLTUI(sugg_dst_ar, EQUAL_FLAG, 1));
|
||||
dst_ar = sugg_dst_ar;
|
||||
break;
|
||||
case SLJIT_C_LESS:
|
||||
case SLJIT_C_GREATER_EQUAL:
|
||||
case SLJIT_C_FLOAT_LESS:
|
||||
case SLJIT_C_FLOAT_GREATER_EQUAL:
|
||||
case SLJIT_LESS:
|
||||
case SLJIT_GREATER_EQUAL:
|
||||
dst_ar = ULESS_FLAG;
|
||||
break;
|
||||
case SLJIT_C_GREATER:
|
||||
case SLJIT_C_LESS_EQUAL:
|
||||
case SLJIT_C_FLOAT_GREATER:
|
||||
case SLJIT_C_FLOAT_LESS_EQUAL:
|
||||
case SLJIT_GREATER:
|
||||
case SLJIT_LESS_EQUAL:
|
||||
dst_ar = UGREATER_FLAG;
|
||||
break;
|
||||
case SLJIT_C_SIG_LESS:
|
||||
case SLJIT_C_SIG_GREATER_EQUAL:
|
||||
case SLJIT_SIG_LESS:
|
||||
case SLJIT_SIG_GREATER_EQUAL:
|
||||
dst_ar = LESS_FLAG;
|
||||
break;
|
||||
case SLJIT_C_SIG_GREATER:
|
||||
case SLJIT_C_SIG_LESS_EQUAL:
|
||||
case SLJIT_SIG_GREATER:
|
||||
case SLJIT_SIG_LESS_EQUAL:
|
||||
dst_ar = GREATER_FLAG;
|
||||
break;
|
||||
case SLJIT_C_OVERFLOW:
|
||||
case SLJIT_C_NOT_OVERFLOW:
|
||||
case SLJIT_OVERFLOW:
|
||||
case SLJIT_NOT_OVERFLOW:
|
||||
dst_ar = OVERFLOW_FLAG;
|
||||
break;
|
||||
case SLJIT_C_MUL_OVERFLOW:
|
||||
case SLJIT_C_MUL_NOT_OVERFLOW:
|
||||
case SLJIT_MUL_OVERFLOW:
|
||||
case SLJIT_MUL_NOT_OVERFLOW:
|
||||
FAIL_IF(CMPLTUI(sugg_dst_ar, OVERFLOW_FLAG, 1));
|
||||
dst_ar = sugg_dst_ar;
|
||||
type ^= 0x1; /* Flip type bit for the XORI below. */
|
||||
break;
|
||||
case SLJIT_C_FLOAT_EQUAL:
|
||||
case SLJIT_C_FLOAT_NOT_EQUAL:
|
||||
dst_ar = EQUAL_FLAG;
|
||||
break;
|
||||
|
||||
default:
|
||||
SLJIT_ASSERT_STOP();
|
||||
@@ -2180,11 +2156,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
|
||||
if (op >= SLJIT_ADD) {
|
||||
if (TMP_REG2_mapped != dst_ar)
|
||||
FAIL_IF(ADD(TMP_REG2_mapped, dst_ar, ZERO));
|
||||
return emit_op(compiler, op | flags, CUMULATIVE_OP | LOGICAL_OP | IMM_OP | ALT_KEEP_CACHE, dst, dstw, src, srcw, TMP_REG2, 0);
|
||||
return emit_op(compiler, op | flags, mem_type | CUMULATIVE_OP | LOGICAL_OP | IMM_OP | ALT_KEEP_CACHE, dst, dstw, src, srcw, TMP_REG2, 0);
|
||||
}
|
||||
|
||||
if (dst & SLJIT_MEM)
|
||||
return emit_op_mem(compiler, WORD_DATA, dst_ar, dst, dstw);
|
||||
return emit_op_mem(compiler, mem_type, dst_ar, dst, dstw);
|
||||
|
||||
if (sugg_dst_ar != dst_ar)
|
||||
return ADD(sugg_dst_ar, dst_ar, ZERO);
|
||||
@@ -2194,7 +2170,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *com
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op) {
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_op0(compiler, op);
|
||||
CHECK(check_sljit_emit_op0(compiler, op));
|
||||
|
||||
op = GET_OPCODE(op);
|
||||
switch (op) {
|
||||
@@ -2204,10 +2180,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
case SLJIT_BREAKPOINT:
|
||||
return PI(BPT);
|
||||
|
||||
case SLJIT_UMUL:
|
||||
case SLJIT_SMUL:
|
||||
case SLJIT_UDIV:
|
||||
case SLJIT_SDIV:
|
||||
case SLJIT_LUMUL:
|
||||
case SLJIT_LSMUL:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
SLJIT_ASSERT_STOP();
|
||||
}
|
||||
|
||||
@@ -2217,7 +2193,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw)
|
||||
{
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw);
|
||||
CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw));
|
||||
ADJUST_LOCAL_OFFSET(dst, dstw);
|
||||
ADJUST_LOCAL_OFFSET(src, srcw);
|
||||
|
||||
@@ -2273,7 +2249,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
|
||||
return emit_op(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), IMM_OP, dst, dstw, SLJIT_IMM, 0, src, srcw);
|
||||
|
||||
case SLJIT_CLZ:
|
||||
return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw);
|
||||
return emit_op(compiler, op, (op & SLJIT_INT_OP) ? INT_DATA : WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw);
|
||||
}
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
@@ -2282,7 +2258,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src1, sljit_sw src1w, sljit_si src2, sljit_sw src2w)
|
||||
{
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w);
|
||||
CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w));
|
||||
ADJUST_LOCAL_OFFSET(dst, dstw);
|
||||
ADJUST_LOCAL_OFFSET(src1, src1w);
|
||||
ADJUST_LOCAL_OFFSET(src2, src2w);
|
||||
@@ -2325,7 +2301,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label * sljit_emit_label(struct sljit_comp
|
||||
flush_buffer(compiler);
|
||||
|
||||
CHECK_ERROR_PTR();
|
||||
check_sljit_emit_label(compiler);
|
||||
CHECK_PTR(check_sljit_emit_label(compiler));
|
||||
|
||||
if (compiler->last_label && compiler->last_label->size == compiler->size)
|
||||
return compiler->last_label;
|
||||
@@ -2344,7 +2320,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
|
||||
flush_buffer(compiler);
|
||||
|
||||
CHECK_ERROR();
|
||||
check_sljit_emit_ijump(compiler, type, src, srcw);
|
||||
CHECK(check_sljit_emit_ijump(compiler, type, src, srcw));
|
||||
ADJUST_LOCAL_OFFSET(src, srcw);
|
||||
|
||||
if (FAST_IS_REG(src)) {
|
||||
@@ -2404,8 +2380,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compil
|
||||
|
||||
return SLJIT_SUCCESS;
|
||||
|
||||
} else if (src & SLJIT_MEM)
|
||||
} else if (src & SLJIT_MEM) {
|
||||
FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, TMP_REG2, 0, TMP_REG1, 0, src, srcw));
|
||||
flush_buffer(compiler);
|
||||
}
|
||||
|
||||
FAIL_IF(JR_SOLO(reg_map[src_r]));
|
||||
|
||||
@@ -2432,7 +2410,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compil
|
||||
flush_buffer(compiler);
|
||||
|
||||
CHECK_ERROR_PTR();
|
||||
check_sljit_emit_jump(compiler, type);
|
||||
CHECK_PTR(check_sljit_emit_jump(compiler, type));
|
||||
|
||||
jump = (struct sljit_jump *)ensure_abuf(compiler, sizeof(struct sljit_jump));
|
||||
PTR_FAIL_IF(!jump);
|
||||
@@ -2440,48 +2418,42 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump * sljit_emit_jump(struct sljit_compil
|
||||
type &= 0xff;
|
||||
|
||||
switch (type) {
|
||||
case SLJIT_C_EQUAL:
|
||||
case SLJIT_C_FLOAT_NOT_EQUAL:
|
||||
case SLJIT_EQUAL:
|
||||
BR_NZ(EQUAL_FLAG);
|
||||
break;
|
||||
case SLJIT_C_NOT_EQUAL:
|
||||
case SLJIT_C_FLOAT_EQUAL:
|
||||
case SLJIT_NOT_EQUAL:
|
||||
BR_Z(EQUAL_FLAG);
|
||||
break;
|
||||
case SLJIT_C_LESS:
|
||||
case SLJIT_C_FLOAT_LESS:
|
||||
case SLJIT_LESS:
|
||||
BR_Z(ULESS_FLAG);
|
||||
break;
|
||||
case SLJIT_C_GREATER_EQUAL:
|
||||
case SLJIT_C_FLOAT_GREATER_EQUAL:
|
||||
case SLJIT_GREATER_EQUAL:
|
||||
BR_NZ(ULESS_FLAG);
|
||||
break;
|
||||
case SLJIT_C_GREATER:
|
||||
case SLJIT_C_FLOAT_GREATER:
|
||||
case SLJIT_GREATER:
|
||||
BR_Z(UGREATER_FLAG);
|
||||
break;
|
||||
case SLJIT_C_LESS_EQUAL:
|
||||
case SLJIT_C_FLOAT_LESS_EQUAL:
|
||||
case SLJIT_LESS_EQUAL:
|
||||
BR_NZ(UGREATER_FLAG);
|
||||
break;
|
||||
case SLJIT_C_SIG_LESS:
|
||||
case SLJIT_SIG_LESS:
|
||||
BR_Z(LESS_FLAG);
|
||||
break;
|
||||
case SLJIT_C_SIG_GREATER_EQUAL:
|
||||
case SLJIT_SIG_GREATER_EQUAL:
|
||||
BR_NZ(LESS_FLAG);
|
||||
break;
|
||||
case SLJIT_C_SIG_GREATER:
|
||||
case SLJIT_SIG_GREATER:
|
||||
BR_Z(GREATER_FLAG);
|
||||
break;
|
||||
case SLJIT_C_SIG_LESS_EQUAL:
|
||||
case SLJIT_SIG_LESS_EQUAL:
|
||||
BR_NZ(GREATER_FLAG);
|
||||
break;
|
||||
case SLJIT_C_OVERFLOW:
|
||||
case SLJIT_C_MUL_OVERFLOW:
|
||||
case SLJIT_OVERFLOW:
|
||||
case SLJIT_MUL_OVERFLOW:
|
||||
BR_Z(OVERFLOW_FLAG);
|
||||
break;
|
||||
case SLJIT_C_NOT_OVERFLOW:
|
||||
case SLJIT_C_MUL_NOT_OVERFLOW:
|
||||
case SLJIT_NOT_OVERFLOW:
|
||||
case SLJIT_MUL_NOT_OVERFLOW:
|
||||
BR_NZ(OVERFLOW_FLAG);
|
||||
break;
|
||||
default:
|
||||
@@ -2536,7 +2508,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const * sljit_emit_const(struct sljit_comp
|
||||
flush_buffer(compiler);
|
||||
|
||||
CHECK_ERROR_PTR();
|
||||
check_sljit_emit_const(compiler, dst, dstw, init_value);
|
||||
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
|
||||
ADJUST_LOCAL_OFFSET(dst, dstw);
|
||||
|
||||
const_ = (struct sljit_const *)ensure_abuf(compiler, sizeof(struct sljit_const));
|
||||
@@ -2572,3 +2544,18 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
|
||||
inst[3] = (inst[3] & ~(0xFFFFL << 43)) | ((new_constant & 0xFFFFL) << 43);
|
||||
SLJIT_CACHE_FLUSH(inst, inst + 4);
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
|
||||
{
|
||||
CHECK_REG_INDEX(check_sljit_get_register_index(reg));
|
||||
return reg_map[reg];
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
|
||||
void *instruction, sljit_si size)
|
||||
{
|
||||
CHECK_ERROR();
|
||||
CHECK(check_sljit_emit_op_custom(compiler, instruction, size));
|
||||
return SLJIT_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,9 @@ static sljit_si cpu_has_sse2 = -1;
|
||||
#endif
|
||||
static sljit_si cpu_has_cmov = -1;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#ifdef _WIN32_WCE
|
||||
#include <cmnintrin.h>
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
@@ -742,8 +744,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
break;
|
||||
case SLJIT_LUMUL:
|
||||
case SLJIT_LSMUL:
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
case SLJIT_SDIVI:
|
||||
compiler->flags_saved = 0;
|
||||
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
#ifdef _WIN64
|
||||
@@ -761,9 +765,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
#endif
|
||||
compiler->mode32 = op & SLJIT_INT_OP;
|
||||
#endif
|
||||
SLJIT_COMPILE_ASSERT((SLJIT_UDIVMOD & 0x2) == 0 && SLJIT_UDIVI - 0x2 == SLJIT_UDIVMOD, bad_div_opcode_assignments);
|
||||
|
||||
op = GET_OPCODE(op);
|
||||
if (op == SLJIT_LUDIV) {
|
||||
if ((op | 0x2) == SLJIT_UDIVI) {
|
||||
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
|
||||
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
|
||||
@@ -774,7 +779,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
*inst = XOR_r_rm;
|
||||
}
|
||||
|
||||
if (op == SLJIT_LSDIV) {
|
||||
if ((op | 0x2) == SLJIT_SDIVI) {
|
||||
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
|
||||
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
|
||||
#endif
|
||||
@@ -805,10 +810,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
FAIL_IF(!inst);
|
||||
INC_SIZE(2);
|
||||
*inst++ = GROUP_F7;
|
||||
*inst = MOD_REG | ((op >= SLJIT_LUDIV) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
|
||||
*inst = MOD_REG | ((op >= SLJIT_UDIVMOD) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
|
||||
#else
|
||||
#ifdef _WIN64
|
||||
size = (!compiler->mode32 || op >= SLJIT_LUDIV) ? 3 : 2;
|
||||
size = (!compiler->mode32 || op >= SLJIT_UDIVMOD) ? 3 : 2;
|
||||
#else
|
||||
size = (!compiler->mode32) ? 3 : 2;
|
||||
#endif
|
||||
@@ -817,11 +822,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
INC_SIZE(size);
|
||||
#ifdef _WIN64
|
||||
if (!compiler->mode32)
|
||||
*inst++ = REX_W | ((op >= SLJIT_LUDIV) ? REX_B : 0);
|
||||
else if (op >= SLJIT_LUDIV)
|
||||
*inst++ = REX_W | ((op >= SLJIT_UDIVMOD) ? REX_B : 0);
|
||||
else if (op >= SLJIT_UDIVMOD)
|
||||
*inst++ = REX_B;
|
||||
*inst++ = GROUP_F7;
|
||||
*inst = MOD_REG | ((op >= SLJIT_LUDIV) ? reg_lmap[TMP_REG1] : reg_lmap[SLJIT_R1]);
|
||||
*inst = MOD_REG | ((op >= SLJIT_UDIVMOD) ? reg_lmap[TMP_REG1] : reg_lmap[SLJIT_R1]);
|
||||
#else
|
||||
if (!compiler->mode32)
|
||||
*inst++ = REX_W;
|
||||
@@ -836,15 +841,21 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler
|
||||
case SLJIT_LSMUL:
|
||||
*inst |= IMUL;
|
||||
break;
|
||||
case SLJIT_LUDIV:
|
||||
case SLJIT_UDIVMOD:
|
||||
case SLJIT_UDIVI:
|
||||
*inst |= DIV;
|
||||
break;
|
||||
case SLJIT_LSDIV:
|
||||
case SLJIT_SDIVMOD:
|
||||
case SLJIT_SDIVI:
|
||||
*inst |= IDIV;
|
||||
break;
|
||||
}
|
||||
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64)
|
||||
EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
|
||||
if (op <= SLJIT_SDIVMOD)
|
||||
EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
|
||||
#else
|
||||
if (op >= SLJIT_UDIVI)
|
||||
EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -1905,60 +1916,62 @@ static sljit_si emit_test_binary(struct sljit_compiler *compiler,
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (FAST_IS_REG(src1)) {
|
||||
if (!(src1 & SLJIT_IMM)) {
|
||||
if (src2 & SLJIT_IMM) {
|
||||
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
if (IS_HALFWORD(src2w) || compiler->mode32) {
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, src1w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = GROUP_F7;
|
||||
}
|
||||
else {
|
||||
FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src2w));
|
||||
inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src1, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src1, src1w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = TEST_rm_r;
|
||||
}
|
||||
#else
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src2w, src1, src1w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = GROUP_F7;
|
||||
#endif
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
else if (FAST_IS_REG(src1)) {
|
||||
inst = emit_x86_instruction(compiler, 1, src1, 0, src2, src2w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = TEST_rm_r;
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
if (FAST_IS_REG(src2)) {
|
||||
if (!(src2 & SLJIT_IMM)) {
|
||||
if (src1 & SLJIT_IMM) {
|
||||
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
if (IS_HALFWORD(src1w) || compiler->mode32) {
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src1w, src2, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, src1w, src2, src2w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = GROUP_F7;
|
||||
}
|
||||
else {
|
||||
FAIL_IF(emit_load_imm64(compiler, TMP_REG2, src1w));
|
||||
inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src2, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, src2, src2w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = TEST_rm_r;
|
||||
}
|
||||
#else
|
||||
inst = emit_x86_instruction(compiler, 1, src1, src1w, src2, 0);
|
||||
inst = emit_x86_instruction(compiler, 1, src1, src1w, src2, src2w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = GROUP_F7;
|
||||
#endif
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
else if (FAST_IS_REG(src2)) {
|
||||
inst = emit_x86_instruction(compiler, 1, src2, 0, src1, src1w);
|
||||
FAIL_IF(!inst);
|
||||
*inst = TEST_rm_r;
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
|
||||
EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
|
||||
@@ -2923,3 +2936,69 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
|
||||
{
|
||||
*(sljit_sw*)addr = new_constant;
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_sse2_available(void)
|
||||
{
|
||||
#if (defined SLJIT_DETECT_SSE2 && SLJIT_DETECT_SSE2)
|
||||
if (cpu_has_sse2 == -1)
|
||||
get_cpu_features();
|
||||
return cpu_has_sse2;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_is_cmov_available(void)
|
||||
{
|
||||
if (cpu_has_cmov == -1)
|
||||
get_cpu_features();
|
||||
return cpu_has_cmov;
|
||||
}
|
||||
|
||||
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_x86_emit_cmov(struct sljit_compiler *compiler,
|
||||
sljit_si type,
|
||||
sljit_si dst_reg,
|
||||
sljit_si src, sljit_sw srcw)
|
||||
{
|
||||
sljit_ub* inst;
|
||||
|
||||
CHECK_ERROR();
|
||||
#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
|
||||
CHECK_ARGUMENT(sljit_x86_is_cmov_available());
|
||||
CHECK_ARGUMENT(!(type & ~(0xff | SLJIT_INT_OP)));
|
||||
CHECK_ARGUMENT((type & 0xff) >= SLJIT_EQUAL && (type & 0xff) <= SLJIT_D_ORDERED);
|
||||
CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(dst_reg & ~SLJIT_INT_OP));
|
||||
FUNCTION_CHECK_SRC(src, srcw);
|
||||
#endif
|
||||
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
|
||||
if (SLJIT_UNLIKELY(!!compiler->verbose)) {
|
||||
fprintf(compiler->verbose, " x86_cmov%s %s%s, ",
|
||||
!(dst_reg & SLJIT_INT_OP) ? "" : ".i",
|
||||
JUMP_PREFIX(type), jump_names[type & 0xff]);
|
||||
sljit_verbose_reg(compiler, dst_reg & ~SLJIT_INT_OP);
|
||||
fprintf(compiler->verbose, ", ");
|
||||
sljit_verbose_param(compiler, src, srcw);
|
||||
fprintf(compiler->verbose, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
ADJUST_LOCAL_OFFSET(src, srcw);
|
||||
CHECK_EXTRA_REGS(src, srcw, (void)0);
|
||||
|
||||
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
|
||||
compiler->mode32 = dst_reg & SLJIT_INT_OP;
|
||||
#endif
|
||||
dst_reg &= ~SLJIT_INT_OP;
|
||||
|
||||
if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
|
||||
EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, srcw);
|
||||
src = TMP_REG1;
|
||||
srcw = 0;
|
||||
}
|
||||
|
||||
inst = emit_x86_instruction(compiler, 2, dst_reg, 0, src, srcw);
|
||||
FAIL_IF(!inst);
|
||||
*inst++ = GROUP_0F;
|
||||
*inst = get_jump_code(type & 0xff) - 0x40;
|
||||
return SLJIT_SUCCESS;
|
||||
}
|
||||
Vendored
+12
@@ -743,3 +743,15 @@ RC=0
|
||||
---------------------------- Test 106 -----------------------------
|
||||
a
|
||||
RC=0
|
||||
---------------------------- Test 107 -----------------------------
|
||||
1:0,1
|
||||
2:0,1
|
||||
2:1,1
|
||||
2:2,1
|
||||
2:3,1
|
||||
2:4,1
|
||||
RC=0
|
||||
---------------------------- Test 108 ------------------------------
|
||||
RC=0
|
||||
---------------------------- Test 109 -----------------------------
|
||||
RC=0
|
||||
Vendored
+13
@@ -5720,4 +5720,17 @@ AbcdCBefgBhiBqz
|
||||
/[\Q]a\E]+/
|
||||
aa]]
|
||||
|
||||
/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
|
||||
1234abcd
|
||||
|
||||
/(\2)(\1)/
|
||||
|
||||
"Z*(|d*){216}"
|
||||
|
||||
"(?1)(?#?'){8}(a)"
|
||||
baaaaaaaaac
|
||||
|
||||
"(?|(\k'Pm')|(?'Pm'))"
|
||||
abcd
|
||||
|
||||
/-- End of testinput1 --/
|
||||
+4
@@ -134,4 +134,8 @@ is required for these tests. --/
|
||||
|
||||
/(((a\2)|(a*)\g<-1>))*a?/B
|
||||
|
||||
/((?+1)(\1))/B
|
||||
|
||||
/.((?2)(?R)\1)()/B
|
||||
|
||||
/-- End of testinput11 --/
|
||||
+17
@@ -8,6 +8,8 @@ and a couple of things that are different with JIT. --/
|
||||
|
||||
/(?(?C1)(?=a)a)/S!+I
|
||||
|
||||
/b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*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b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*Line truncated
|
||||
|
||||
/abc/S+I>testsavedregex
|
||||
|
||||
<testsavedregex
|
||||
@@ -87,4 +89,19 @@ and a couple of things that are different with JIT. --/
|
||||
/^12345678abcd/mS++
|
||||
12345678abcd
|
||||
|
||||
/-- Test pattern compilation --/
|
||||
|
||||
/(?:a|b|c|d|e)(?R)/S++
|
||||
|
||||
/(?:a|b|c|d|e)(?R)(?R)/S++
|
||||
|
||||
/(a(?:a|b|c|d|e)b){8,16}/S++
|
||||
|
||||
/(?:|a|){100}x/S++
|
||||
|
||||
/(x(?1)){4}/S++
|
||||
|
||||
/(.|.)*?bx/
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
|
||||
|
||||
/-- End of testinput12 --/
|
||||
+2
@@ -340,4 +340,6 @@ not matter. --/
|
||||
|
||||
/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
|
||||
|
||||
/(?'ABC'[bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar](*THEN:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/
|
||||
|
||||
/-- End of testinput14 --/
|
||||
+2
@@ -304,4 +304,6 @@
|
||||
/^[\x{1234}\x{4321}]{2,4}?/
|
||||
\x{1234}\x{1234}\x{1234}
|
||||
|
||||
/(*THEN:AAAAAAAAAAAAAAAAAA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
@@ -4078,4 +4080,141 @@ backtracking verbs. --/
|
||||
|
||||
/\x{whatever}/
|
||||
|
||||
"((?=(?(?=(?(?=(?(?=()))))))))"
|
||||
a
|
||||
|
||||
"(?(?=)==)(((((((((?=)))))))))"
|
||||
a
|
||||
|
||||
/^(?:(a)|b)(?(1)A|B)/I
|
||||
aA123\O3
|
||||
aA123\O6
|
||||
|
||||
'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
|
||||
aA123\O3
|
||||
aA123\O6
|
||||
|
||||
'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'J
|
||||
aA123\O3
|
||||
aA123\O6
|
||||
|
||||
'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'J
|
||||
aa123\O3
|
||||
aa123\O6
|
||||
|
||||
/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
|
||||
|
||||
/(?(?=0)?)+/
|
||||
|
||||
/(?(?=0)(?=00)?00765)/
|
||||
00765
|
||||
|
||||
/(?(?=0)(?=00)?00765|(?!3).56)/
|
||||
00765
|
||||
456
|
||||
** Failers
|
||||
356
|
||||
|
||||
'^(a)*+(\w)'
|
||||
g
|
||||
g\O3
|
||||
|
||||
'^(?:a)*+(\w)'
|
||||
g
|
||||
g\O3
|
||||
|
||||
//C
|
||||
\O\C+
|
||||
|
||||
"((?2){0,1999}())?"
|
||||
|
||||
/((?+1)(\1))/BZ
|
||||
|
||||
/(?(?!)a|b)/
|
||||
bbb
|
||||
aaa
|
||||
|
||||
"((?2)+)((?1))"
|
||||
|
||||
"(?(?<E>.*!.*)?)"
|
||||
|
||||
"X((?2)()*+){2}+"BZ
|
||||
|
||||
"X((?2)()*+){2}"BZ
|
||||
|
||||
"(?<=((?2))((?1)))"
|
||||
|
||||
/(?<=\Ka)/g+
|
||||
aaaaa
|
||||
|
||||
/(?<=\Ka)/G+
|
||||
aaaaa
|
||||
|
||||
/((?2){73}(?2))((?1))/
|
||||
|
||||
/.((?2)(?R)\1)()/BZ
|
||||
|
||||
/(?1)()((((((\1++))\x85)+)|))/
|
||||
|
||||
/(\9*+(?2);\3++()2|)++{/
|
||||
|
||||
/\V\x85\9*+((?2)\3++()2)*:2/
|
||||
|
||||
/(((?(R)){0,2}) (?''((?'R')((?'R')))))/J
|
||||
|
||||
/(((?(X)){0,2}) (?''((?'X')((?'X')))))/J
|
||||
|
||||
/(((?(R)){0,2}) (?''((?'X')((?'R')))))/
|
||||
|
||||
"(?J)(?'d'(?'d'\g{d}))"
|
||||
|
||||
".*?\h.+.\.+\R*?\xd(?i)(?=!(?=b`b`b`\`b\xa9b!)`\a`bbbbbbbbbbbbb`bbbbbbbbbbbb*R\x85bbbbbbb\C?{((?2)(?))((
|
||||
\H){8(?<=(?1){29}\xa8bbbb\x16\xd\xc6^($(?<! )(\xa9H4){4}h}1)B))\x15')"
|
||||
|
||||
"(?J:(?|(?'R')(\k'R')|((?'R'))))"
|
||||
|
||||
/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
|
||||
|
||||
//
|
||||
\O1
|
||||
|
||||
/^(?:(?(1)x|)+)+$()/BZ
|
||||
|
||||
/(?=di(?<=(?1))|(?=(.))))/
|
||||
|
||||
/(?(R))*+/BZ
|
||||
|
||||
/[[:\\](?'abc')[a:]/
|
||||
|
||||
"[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
|
||||
|
||||
/()(?(R)0)*+/BZ
|
||||
|
||||
/(?R-:(?</
|
||||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a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&a)(?&Line truncated
|
||||
|
||||
/a[[:punct:]b]/BZ
|
||||
|
||||
/-- End of testinput2 --/
|
||||
Vendored
+5
@@ -722,4 +722,9 @@
|
||||
/^#[^\x{ffff}]#[^\x{ffff}]#[^\x{ffff}]#/8
|
||||
#\x{10000}#\x{100}#\x{10ffff}#
|
||||
|
||||
"[\S\V\H]"8
|
||||
|
||||
/\C(\W?ſ)'?{{/8
|
||||
\\C(\\W?ſ)'?{{
|
||||
|
||||
/-- End of testinput4 --/
|
||||
Vendored
+8
@@ -790,4 +790,12 @@
|
||||
|
||||
/[b-d\x{200}-\x{250}]*[ae-h]?#[\x{200}-\x{250}]{0,8}[\x00-\xff]*#[\x{200}-\x{250}]+[a-z]/8BZ
|
||||
|
||||
/[^\xff]*PRUNE:\x{100}abc(xyz(?1))/8DZ
|
||||
|
||||
/(?<=\K\x{17f})/8g+
|
||||
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||
|
||||
/(?<=\K\x{17f})/8G+
|
||||
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||
|
||||
/-- End of testinput5 --/
|
||||
Vendored
+57
@@ -1496,4 +1496,61 @@
|
||||
/^s?c/mi8
|
||||
scat
|
||||
|
||||
/[A-`]/i8
|
||||
abcdefghijklmno
|
||||
|
||||
/\C\X*QT/8
|
||||
Ӆ\x0aT
|
||||
|
||||
/[\pS#moq]/
|
||||
=
|
||||
|
||||
/[[:punct:]]/8W
|
||||
\xc2\xb4
|
||||
\x{b4}
|
||||
|
||||
/[[:^ascii:]]/8W
|
||||
\x{100}
|
||||
\x{200}
|
||||
\x{300}
|
||||
\x{37e}
|
||||
a
|
||||
9
|
||||
g
|
||||
|
||||
/[[:^ascii:]\w]/8W
|
||||
a
|
||||
9
|
||||
g
|
||||
\x{100}
|
||||
\x{200}
|
||||
\x{300}
|
||||
\x{37e}
|
||||
|
||||
/[\w[:^ascii:]]/8W
|
||||
a
|
||||
9
|
||||
g
|
||||
\x{100}
|
||||
\x{200}
|
||||
\x{300}
|
||||
\x{37e}
|
||||
|
||||
/[^[:ascii:]\W]/8W
|
||||
a
|
||||
9
|
||||
g
|
||||
\x{100}
|
||||
\x{200}
|
||||
\x{300}
|
||||
\x{37e}
|
||||
|
||||
/[[:^ascii:]a]/8W
|
||||
a
|
||||
9
|
||||
g
|
||||
\x{100}
|
||||
\x{200}
|
||||
\x{37e}
|
||||
|
||||
/-- End of testinput6 --/
|
||||
Vendored
+15
@@ -838,4 +838,19 @@ of case for anything other than the ASCII letters. --/
|
||||
/^s?c/mi8I
|
||||
scat
|
||||
|
||||
/[\W\p{Any}]/BZ
|
||||
abc
|
||||
123
|
||||
|
||||
/[\W\pL]/BZ
|
||||
abc
|
||||
** Failers
|
||||
123
|
||||
|
||||
/a[[:punct:]b]/WBZ
|
||||
|
||||
/a[[:punct:]b]/8WBZ
|
||||
|
||||
/a[b[:punct:]]/8WBZ
|
||||
|
||||
/-- End of testinput7 --/
|
||||
Vendored
+4
@@ -4837,4 +4837,8 @@
|
||||
'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++'
|
||||
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
|
||||
|
||||
/(?(?!)a|b)/
|
||||
bbb
|
||||
aaa
|
||||
|
||||
/-- End of testinput8 --/
|
||||
+3
@@ -29,13 +29,16 @@ in EBCDIC, but can be specified as escapes. --/
|
||||
|
||||
/^A\ˆ/
|
||||
A B
|
||||
A\x41B
|
||||
|
||||
/-- Test \H --/
|
||||
|
||||
/^A\È/
|
||||
AB
|
||||
A\x42B
|
||||
** Fail
|
||||
A B
|
||||
A\x41B
|
||||
|
||||
/-- Test \R --/
|
||||
|
||||
|
||||
+23
@@ -9411,4 +9411,27 @@ No match
|
||||
aa]]
|
||||
0: aa]]
|
||||
|
||||
/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
|
||||
1234abcd
|
||||
0:
|
||||
1: <unset>
|
||||
2: <unset>
|
||||
3: <unset>
|
||||
4: <unset>
|
||||
5:
|
||||
|
||||
/(\2)(\1)/
|
||||
|
||||
"Z*(|d*){216}"
|
||||
|
||||
"(?1)(?#?'){8}(a)"
|
||||
baaaaaaaaac
|
||||
0: aaaaaaaaa
|
||||
1: a
|
||||
|
||||
"(?|(\k'Pm')|(?'Pm'))"
|
||||
abcd
|
||||
0:
|
||||
1:
|
||||
|
||||
/-- End of testinput1 --/
|
||||
+41
-9
@@ -231,7 +231,7 @@ Memory allocation (code space): 73
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
|
||||
Memory allocation (code space): 57
|
||||
Memory allocation (code space): 77
|
||||
------------------------------------------------------------------
|
||||
0 24 Bra
|
||||
2 5 CBra 1
|
||||
@@ -650,18 +650,18 @@ Memory allocation (code space): 14
|
||||
|
||||
/[[:^alpha:][:^cntrl:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 26 Bra
|
||||
2 [ -~\x80-\xff\P{L}]++
|
||||
26 26 Ket
|
||||
28 End
|
||||
0 30 Bra
|
||||
2 [ -~\x80-\xff\P{L}\x{100}-\x{10ffff}]++
|
||||
30 30 Ket
|
||||
32 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:^cntrl:][:^alpha:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 26 Bra
|
||||
2 [ -~\x80-\xff\P{L}]++
|
||||
26 26 Ket
|
||||
28 End
|
||||
0 30 Bra
|
||||
2 [ -~\x80-\xff\x{100}-\x{10ffff}\P{L}]++
|
||||
30 30 Ket
|
||||
32 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:alpha:]]+/8WB
|
||||
@@ -733,4 +733,36 @@ Memory allocation (code space): 14
|
||||
41 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/((?+1)(\1))/B
|
||||
------------------------------------------------------------------
|
||||
0 20 Bra
|
||||
2 16 Once
|
||||
4 12 CBra 1
|
||||
7 9 Recurse
|
||||
9 5 CBra 2
|
||||
12 \1
|
||||
14 5 Ket
|
||||
16 12 Ket
|
||||
18 16 Ket
|
||||
20 20 Ket
|
||||
22 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/.((?2)(?R)\1)()/B
|
||||
------------------------------------------------------------------
|
||||
0 23 Bra
|
||||
2 Any
|
||||
3 13 Once
|
||||
5 9 CBra 1
|
||||
8 18 Recurse
|
||||
10 0 Recurse
|
||||
12 \1
|
||||
14 9 Ket
|
||||
16 13 Ket
|
||||
18 3 CBra 2
|
||||
21 3 Ket
|
||||
23 23 Ket
|
||||
25 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/-- End of testinput11 --/
|
||||
+41
-9
@@ -231,7 +231,7 @@ Memory allocation (code space): 155
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
|
||||
Memory allocation (code space): 117
|
||||
Memory allocation (code space): 157
|
||||
------------------------------------------------------------------
|
||||
0 24 Bra
|
||||
2 5 CBra 1
|
||||
@@ -650,18 +650,18 @@ Memory allocation (code space): 28
|
||||
|
||||
/[[:^alpha:][:^cntrl:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 18 Bra
|
||||
2 [ -~\x80-\xff\P{L}]++
|
||||
18 18 Ket
|
||||
20 End
|
||||
0 21 Bra
|
||||
2 [ -~\x80-\xff\P{L}\x{100}-\x{10ffff}]++
|
||||
21 21 Ket
|
||||
23 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:^cntrl:][:^alpha:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 18 Bra
|
||||
2 [ -~\x80-\xff\P{L}]++
|
||||
18 18 Ket
|
||||
20 End
|
||||
0 21 Bra
|
||||
2 [ -~\x80-\xff\x{100}-\x{10ffff}\P{L}]++
|
||||
21 21 Ket
|
||||
23 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:alpha:]]+/8WB
|
||||
@@ -733,4 +733,36 @@ Memory allocation (code space): 28
|
||||
41 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/((?+1)(\1))/B
|
||||
------------------------------------------------------------------
|
||||
0 20 Bra
|
||||
2 16 Once
|
||||
4 12 CBra 1
|
||||
7 9 Recurse
|
||||
9 5 CBra 2
|
||||
12 \1
|
||||
14 5 Ket
|
||||
16 12 Ket
|
||||
18 16 Ket
|
||||
20 20 Ket
|
||||
22 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/.((?2)(?R)\1)()/B
|
||||
------------------------------------------------------------------
|
||||
0 23 Bra
|
||||
2 Any
|
||||
3 13 Once
|
||||
5 9 CBra 1
|
||||
8 18 Recurse
|
||||
10 0 Recurse
|
||||
12 \1
|
||||
14 9 Ket
|
||||
16 13 Ket
|
||||
18 3 CBra 2
|
||||
21 3 Ket
|
||||
23 23 Ket
|
||||
25 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/-- End of testinput11 --/
|
||||
+41
-9
@@ -231,7 +231,7 @@ Memory allocation (code space): 45
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
|
||||
Memory allocation (code space): 34
|
||||
Memory allocation (code space): 50
|
||||
------------------------------------------------------------------
|
||||
0 30 Bra
|
||||
3 7 CBra 1
|
||||
@@ -650,18 +650,18 @@ Memory allocation (code space): 10
|
||||
|
||||
/[[:^alpha:][:^cntrl:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 44 Bra
|
||||
3 [ -~\x80-\xff\P{L}]++
|
||||
44 44 Ket
|
||||
47 End
|
||||
0 51 Bra
|
||||
3 [ -~\x80-\xff\P{L}\x{100}-\x{10ffff}]++
|
||||
51 51 Ket
|
||||
54 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:^cntrl:][:^alpha:]]+/8WB
|
||||
------------------------------------------------------------------
|
||||
0 44 Bra
|
||||
3 [ -~\x80-\xff\P{L}]++
|
||||
44 44 Ket
|
||||
47 End
|
||||
0 51 Bra
|
||||
3 [ -~\x80-\xff\x{100}-\x{10ffff}\P{L}]++
|
||||
51 51 Ket
|
||||
54 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:alpha:]]+/8WB
|
||||
@@ -733,4 +733,36 @@ Memory allocation (code space): 10
|
||||
60 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/((?+1)(\1))/B
|
||||
------------------------------------------------------------------
|
||||
0 31 Bra
|
||||
3 25 Once
|
||||
6 19 CBra 1
|
||||
11 14 Recurse
|
||||
14 8 CBra 2
|
||||
19 \1
|
||||
22 8 Ket
|
||||
25 19 Ket
|
||||
28 25 Ket
|
||||
31 31 Ket
|
||||
34 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/.((?2)(?R)\1)()/B
|
||||
------------------------------------------------------------------
|
||||
0 35 Bra
|
||||
3 Any
|
||||
4 20 Once
|
||||
7 14 CBra 1
|
||||
12 27 Recurse
|
||||
15 0 Recurse
|
||||
18 \1
|
||||
21 14 Ket
|
||||
24 20 Ket
|
||||
27 5 CBra 2
|
||||
32 5 Ket
|
||||
35 35 Ket
|
||||
38 End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/-- End of testinput11 --/
|
||||
+25
@@ -30,6 +30,15 @@ Subject length lower bound = -1
|
||||
No starting char list
|
||||
JIT study was not successful
|
||||
|
||||
/b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*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b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*Line truncated
|
||||
Capturing subpattern count = 0
|
||||
May match empty string
|
||||
No options
|
||||
No first char
|
||||
No need char
|
||||
Study returned NULL
|
||||
JIT study was not successful
|
||||
|
||||
/abc/S+I>testsavedregex
|
||||
Capturing subpattern count = 0
|
||||
No options
|
||||
@@ -176,4 +185,20 @@ No match, mark = m (JIT)
|
||||
12345678abcd
|
||||
0: 12345678abcd (JIT)
|
||||
|
||||
/-- Test pattern compilation --/
|
||||
|
||||
/(?:a|b|c|d|e)(?R)/S++
|
||||
|
||||
/(?:a|b|c|d|e)(?R)(?R)/S++
|
||||
|
||||
/(a(?:a|b|c|d|e)b){8,16}/S++
|
||||
|
||||
/(?:|a|){100}x/S++
|
||||
|
||||
/(x(?1)){4}/S++
|
||||
|
||||
/(.|.)*?bx/
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
|
||||
Error -8 (match limit exceeded)
|
||||
|
||||
/-- End of testinput12 --/
|
||||
+2
@@ -527,4 +527,6 @@ Failed: character value in \u.... sequence is too large at offset 6
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?'ABC'[bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar]([bar](*THEN:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/
|
||||
|
||||
/-- End of testinput14 --/
|
||||
+2
@@ -555,4 +555,6 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB
|
||||
\x{1234}\x{1234}\x{1234}
|
||||
0: \x{1234}\x{1234}
|
||||
|
||||
/(*THEN:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALine truncated
|
||||
|
||||
/-- End of testinput17 --/
|
||||
+374
-6
@@ -561,7 +561,7 @@ Failed: assertion expected after (?( at offset 3
|
||||
Failed: reference to non-existent subpattern at offset 7
|
||||
|
||||
/(?(?<ab))/
|
||||
Failed: syntax error in subpattern name (missing terminator) at offset 7
|
||||
Failed: assertion expected after (?( at offset 3
|
||||
|
||||
/((?s)blah)\s+\1/I
|
||||
Capturing subpattern count = 1
|
||||
@@ -1566,30 +1566,35 @@ Need char = 'b'
|
||||
|
||||
/a(?(1)b)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
No need char
|
||||
|
||||
/a(?(1)bag|big)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
Need char = 'g'
|
||||
|
||||
/a(?(1)bag|big)*(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
No need char
|
||||
|
||||
/a(?(1)bag|big)+(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
Need char = 'g'
|
||||
|
||||
/a(?(1)b..|b..)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
Need char = 'b'
|
||||
@@ -3379,24 +3384,28 @@ Need char = 'a'
|
||||
|
||||
/(?(1)ab|ac)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
No need char
|
||||
|
||||
/(?(1)abz|acz)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
First char = 'a'
|
||||
Need char = 'z'
|
||||
|
||||
/(?(1)abz)(.)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
No first char
|
||||
No need char
|
||||
|
||||
/(?(1)abz)(1)23/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
No first char
|
||||
Need char = '3'
|
||||
@@ -5605,6 +5614,10 @@ No match
|
||||
123456\P
|
||||
No match
|
||||
|
||||
//KF>testsavedregex
|
||||
Compiled pattern written to testsavedregex
|
||||
Study data written to testsavedregex
|
||||
|
||||
/abc/IS>testsavedregex
|
||||
Capturing subpattern count = 0
|
||||
No options
|
||||
@@ -6336,6 +6349,7 @@ No need char
|
||||
|
||||
/^(?P<A>a)?(?(A)a|b)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
A 1
|
||||
Options: anchored
|
||||
@@ -6353,6 +6367,7 @@ No match
|
||||
|
||||
/(?:(?(ZZ)a|b)(?P<ZZ>X))+/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
ZZ 1
|
||||
No options
|
||||
@@ -6370,6 +6385,7 @@ Failed: reference to non-existent subpattern at offset 9
|
||||
|
||||
/(?:(?(ZZ)a|b)(?(ZZ)a|b)(?P<ZZ>X))+/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
ZZ 1
|
||||
No options
|
||||
@@ -6381,6 +6397,7 @@ Need char = 'X'
|
||||
|
||||
/(?:(?(ZZ)a|\(b\))\\(?P<ZZ>X))+/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
ZZ 1
|
||||
No options
|
||||
@@ -9118,10 +9135,10 @@ Failed: subpattern name expected at offset 3
|
||||
Failed: subpattern name expected at offset 3
|
||||
|
||||
/\k/
|
||||
Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 2
|
||||
Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 1
|
||||
|
||||
/\kabc/
|
||||
Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 5
|
||||
Failed: \k is not followed by a braced, angle-bracketed, or quoted name at offset 1
|
||||
|
||||
/(?P=)/
|
||||
Failed: subpattern name expected at offset 4
|
||||
@@ -9169,7 +9186,7 @@ Failed: unknown POSIX class name at offset 6
|
||||
Failed: unknown POSIX class name at offset 3
|
||||
|
||||
/(^(a|b\g<-1'c))/
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 15
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 8
|
||||
|
||||
/^(?+1)(?<a>x|y){0}z/
|
||||
xzxx
|
||||
@@ -10226,6 +10243,7 @@ No starting char list
|
||||
(?(1)|.) # check that there was an empty component
|
||||
/xiIS
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Options: anchored caseless extended
|
||||
No first char
|
||||
Need char = ':'
|
||||
@@ -10255,6 +10273,7 @@ Failed: different names for subpatterns of the same number are not allowed at of
|
||||
b(?<quote> (?<apostrophe>')|(?<realquote>")) )
|
||||
(?('quote')[a-z]+|[0-9]+)/JIx
|
||||
Capturing subpattern count = 6
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
apostrophe 2
|
||||
apostrophe 5
|
||||
@@ -10317,6 +10336,7 @@ No match
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
Capturing subpattern count = 4
|
||||
Max back reference = 4
|
||||
Named capturing subpatterns:
|
||||
D 4
|
||||
D 1
|
||||
@@ -10364,6 +10384,7 @@ No match
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
Capturing subpattern count = 4
|
||||
Max back reference = 1
|
||||
Named capturing subpatterns:
|
||||
A 1
|
||||
A 4
|
||||
@@ -10486,6 +10507,7 @@ No starting char list
|
||||
|
||||
/()i(?(1)a)/SI
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
No options
|
||||
No first char
|
||||
Need char = 'i'
|
||||
@@ -14076,10 +14098,10 @@ Failed: group name must start with a non-digit at offset 3
|
||||
Failed: group name must start with a non-digit at offset 4
|
||||
|
||||
/\g'3gh'/
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 2
|
||||
|
||||
/\g<5fg>/
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
|
||||
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 2
|
||||
|
||||
/(?(<4gh>)abc)/
|
||||
Failed: group name must start with a non-digit at offset 4
|
||||
@@ -14206,4 +14228,350 @@ Failed: digits missing in \x{} or \o{} at offset 3
|
||||
/\x{whatever}/
|
||||
Failed: non-hex character in \x{} (closing brace missing?) at offset 3
|
||||
|
||||
"((?=(?(?=(?(?=(?(?=()))))))))"
|
||||
a
|
||||
0:
|
||||
1:
|
||||
2:
|
||||
|
||||
"(?(?=)==)(((((((((?=)))))))))"
|
||||
a
|
||||
No match
|
||||
|
||||
/^(?:(a)|b)(?(1)A|B)/I
|
||||
Capturing subpattern count = 1
|
||||
Max back reference = 1
|
||||
Options: anchored
|
||||
No first char
|
||||
No need char
|
||||
aA123\O3
|
||||
Matched, but too many substrings
|
||||
0: aA
|
||||
aA123\O6
|
||||
0: aA
|
||||
1: a
|
||||
|
||||
'^(?:(?<AA>a)|b)(?(<AA>)A|B)'
|
||||
aA123\O3
|
||||
Matched, but too many substrings
|
||||
0: aA
|
||||
aA123\O6
|
||||
0: aA
|
||||
1: a
|
||||
|
||||
'^(?<AA>)(?:(?<AA>a)|b)(?(<AA>)A|B)'J
|
||||
aA123\O3
|
||||
Matched, but too many substrings
|
||||
0: aA
|
||||
aA123\O6
|
||||
Matched, but too many substrings
|
||||
0: aA
|
||||
1:
|
||||
|
||||
'^(?:(?<AA>X)|)(?:(?<AA>a)|b)\k{AA}'J
|
||||
aa123\O3
|
||||
Matched, but too many substrings
|
||||
0: aa
|
||||
aa123\O6
|
||||
Matched, but too many substrings
|
||||
0: aa
|
||||
1: <unset>
|
||||
|
||||
/(?<N111>(?J)(?<N111>1(111111)11|)1|1|)(?(<N111>)1)/
|
||||
|
||||
/(?(?=0)?)+/
|
||||
Failed: nothing to repeat at offset 7
|
||||
|
||||
/(?(?=0)(?=00)?00765)/
|
||||
00765
|
||||
0: 00765
|
||||
|
||||
/(?(?=0)(?=00)?00765|(?!3).56)/
|
||||
00765
|
||||
0: 00765
|
||||
456
|
||||
0: 456
|
||||
** Failers
|
||||
No match
|
||||
356
|
||||
No match
|
||||
|
||||
'^(a)*+(\w)'
|
||||
g
|
||||
0: g
|
||||
1: <unset>
|
||||
2: g
|
||||
g\O3
|
||||
Matched, but too many substrings
|
||||
0: g
|
||||
|
||||
'^(?:a)*+(\w)'
|
||||
g
|
||||
0: g
|
||||
1: g
|
||||
g\O3
|
||||
Matched, but too many substrings
|
||||
0: g
|
||||
|
||||
//C
|
||||
\O\C+
|
||||
Callout 255: last capture = -1
|
||||
--->
|
||||
+0 ^
|
||||
Matched, but too many substrings
|
||||
|
||||
"((?2){0,1999}())?"
|
||||
|
||||
/((?+1)(\1))/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
Once
|
||||
CBra 1
|
||||
Recurse
|
||||
CBra 2
|
||||
\1
|
||||
Ket
|
||||
Ket
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?(?!)a|b)/
|
||||
bbb
|
||||
0: b
|
||||
aaa
|
||||
No match
|
||||
|
||||
"((?2)+)((?1))"
|
||||
|
||||
"(?(?<E>.*!.*)?)"
|
||||
Failed: assertion expected after (?( at offset 3
|
||||
|
||||
"X((?2)()*+){2}+"BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
X
|
||||
Once
|
||||
CBra 1
|
||||
Recurse
|
||||
Braposzero
|
||||
SCBraPos 2
|
||||
KetRpos
|
||||
Ket
|
||||
CBra 1
|
||||
Recurse
|
||||
Braposzero
|
||||
SCBraPos 2
|
||||
KetRpos
|
||||
Ket
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
"X((?2)()*+){2}"BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
X
|
||||
CBra 1
|
||||
Recurse
|
||||
Braposzero
|
||||
SCBraPos 2
|
||||
KetRpos
|
||||
Ket
|
||||
CBra 1
|
||||
Recurse
|
||||
Braposzero
|
||||
SCBraPos 2
|
||||
KetRpos
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
"(?<=((?2))((?1)))"
|
||||
Failed: lookbehind assertion is not fixed length at offset 17
|
||||
|
||||
/(?<=\Ka)/g+
|
||||
aaaaa
|
||||
0: a
|
||||
0+ aaaa
|
||||
0: a
|
||||
0+ aaaa
|
||||
0: a
|
||||
0+ aaa
|
||||
0: a
|
||||
0+ aa
|
||||
0: a
|
||||
0+ a
|
||||
0: a
|
||||
0+
|
||||
|
||||
/(?<=\Ka)/G+
|
||||
aaaaa
|
||||
0: a
|
||||
0+ aaaa
|
||||
0: a
|
||||
0+ aaa
|
||||
0: a
|
||||
0+ aa
|
||||
0: a
|
||||
0+ a
|
||||
0: a
|
||||
0+
|
||||
|
||||
/((?2){73}(?2))((?1))/
|
||||
|
||||
/.((?2)(?R)\1)()/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
Any
|
||||
Once
|
||||
CBra 1
|
||||
Recurse
|
||||
Recurse
|
||||
\1
|
||||
Ket
|
||||
Ket
|
||||
CBra 2
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?1)()((((((\1++))\x85)+)|))/
|
||||
|
||||
/(\9*+(?2);\3++()2|)++{/
|
||||
Failed: reference to non-existent subpattern at offset 22
|
||||
|
||||
/\V\x85\9*+((?2)\3++()2)*:2/
|
||||
Failed: reference to non-existent subpattern at offset 26
|
||||
|
||||
/(((?(R)){0,2}) (?''((?'R')((?'R')))))/J
|
||||
|
||||
/(((?(X)){0,2}) (?''((?'X')((?'X')))))/J
|
||||
|
||||
/(((?(R)){0,2}) (?''((?'X')((?'R')))))/
|
||||
|
||||
"(?J)(?'d'(?'d'\g{d}))"
|
||||
|
||||
".*?\h.+.\.+\R*?\xd(?i)(?=!(?=b`b`b`\`b\xa9b!)`\a`bbbbbbbbbbbbb`bbbbbbbbbbbb*R\x85bbbbbbb\C?{((?2)(?))((
|
||||
\H){8(?<=(?1){29}\xa8bbbb\x16\xd\xc6^($(?<! )(\xa9H4){4}h}1)B))\x15')"
|
||||
|
||||
"(?J:(?|(?'R')(\k'R')|((?'R'))))"
|
||||
|
||||
/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
|
||||
Failed: number is too big at offset 32
|
||||
|
||||
//
|
||||
\O1
|
||||
Matched, but too many substrings
|
||||
|
||||
/^(?:(?(1)x|)+)+$()/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
^
|
||||
SBra
|
||||
SCond
|
||||
1 Cond ref
|
||||
x
|
||||
Alt
|
||||
KetRmax
|
||||
KetRmax
|
||||
$
|
||||
CBra 1
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?=di(?<=(?1))|(?=(.))))/
|
||||
Failed: unmatched parentheses at offset 23
|
||||
|
||||
/(?(R))*+/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
Braposzero
|
||||
SBraPos
|
||||
SCond
|
||||
Cond recurse any
|
||||
Ket
|
||||
KetRpos
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[[:\\](?'abc')[a:]/
|
||||
|
||||
"[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
|
||||
Failed: missing terminating ] for character class at offset 353
|
||||
|
||||
/()(?(R)0)*+/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
CBra 1
|
||||
Ket
|
||||
Braposzero
|
||||
SBraPos
|
||||
SCond
|
||||
Cond recurse any
|
||||
0
|
||||
Ket
|
||||
KetRpos
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/(?R-:(?</
|
||||
Failed: (?R or (?[+-]digits must be followed by ) at offset 3
|
||||
|
||||
/(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I
|
||||
Capturing subpattern count = 8
|
||||
Max back reference = 8
|
||||
Named capturing subpatterns:
|
||||
R 7
|
||||
R 8
|
||||
No options
|
||||
Duplicate name status changes
|
||||
No first char
|
||||
Need char = '0'
|
||||
|
||||
/(?J:(?|(:(?|(?'R')(\k'R')|((?'R')))H'Rk'Rf)|s(?'R')))/
|
||||
|
||||
/0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/
|
||||
01
|
||||
No match
|
||||
|
||||
/((?(R8000000000)))/
|
||||
Failed: number is too big at offset 16
|
||||
|
||||
/(?(8000000000/
|
||||
Failed: number is too big at offset 13
|
||||
|
||||
/(?:ab)?(?:ab)(?:ab)/
|
||||
abab
|
||||
0: abab
|
||||
ababab
|
||||
0: ababab
|
||||
aba
|
||||
No match
|
||||
|
||||
/((*MARK:A))++a(*S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truncated
|
||||
|
||||
/a[[:punct:]b]/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
a
|
||||
[!-/:-@[-`b{-~]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/-- End of testinput2 --/
|
||||
+6
@@ -1271,4 +1271,10 @@ No match
|
||||
#\x{10000}#\x{100}#\x{10ffff}#
|
||||
0: #\x{10000}#\x{100}#\x{10ffff}#
|
||||
|
||||
"[\S\V\H]"8
|
||||
|
||||
/\C(\W?ſ)'?{{/8
|
||||
\\C(\\W?ſ)'?{{
|
||||
No match
|
||||
|
||||
/-- End of testinput4 --/
|
||||
+45
@@ -1897,4 +1897,49 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 5
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/[^\xff]*PRUNE:\x{100}abc(xyz(?1))/8DZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[^\x{ff}]*
|
||||
PRUNE:\x{100}abc
|
||||
CBra 1
|
||||
xyz
|
||||
Recurse
|
||||
Ket
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
Capturing subpattern count = 1
|
||||
Options: utf
|
||||
No first char
|
||||
Need char = 'z'
|
||||
|
||||
/(?<=\K\x{17f})/8g+
|
||||
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}
|
||||
0: \x{17f}
|
||||
0+
|
||||
|
||||
/(?<=\K\x{17f})/8G+
|
||||
\x{17f}\x{17f}\x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}\x{17f}
|
||||
0: \x{17f}
|
||||
0+ \x{17f}
|
||||
0: \x{17f}
|
||||
0+
|
||||
|
||||
/-- End of testinput5 --/
|
||||
+96
@@ -2461,4 +2461,100 @@ No match
|
||||
scat
|
||||
0: sc
|
||||
|
||||
/[A-`]/i8
|
||||
abcdefghijklmno
|
||||
0: a
|
||||
|
||||
/\C\X*QT/8
|
||||
Ӆ\x0aT
|
||||
No match
|
||||
|
||||
/[\pS#moq]/
|
||||
=
|
||||
0: =
|
||||
|
||||
/[[:punct:]]/8W
|
||||
\xc2\xb4
|
||||
No match
|
||||
\x{b4}
|
||||
No match
|
||||
|
||||
/[[:^ascii:]]/8W
|
||||
\x{100}
|
||||
0: \x{100}
|
||||
\x{200}
|
||||
0: \x{200}
|
||||
\x{300}
|
||||
0: \x{300}
|
||||
\x{37e}
|
||||
0: \x{37e}
|
||||
a
|
||||
No match
|
||||
9
|
||||
No match
|
||||
g
|
||||
No match
|
||||
|
||||
/[[:^ascii:]\w]/8W
|
||||
a
|
||||
0: a
|
||||
9
|
||||
0: 9
|
||||
g
|
||||
0: g
|
||||
\x{100}
|
||||
0: \x{100}
|
||||
\x{200}
|
||||
0: \x{200}
|
||||
\x{300}
|
||||
0: \x{300}
|
||||
\x{37e}
|
||||
0: \x{37e}
|
||||
|
||||
/[\w[:^ascii:]]/8W
|
||||
a
|
||||
0: a
|
||||
9
|
||||
0: 9
|
||||
g
|
||||
0: g
|
||||
\x{100}
|
||||
0: \x{100}
|
||||
\x{200}
|
||||
0: \x{200}
|
||||
\x{300}
|
||||
0: \x{300}
|
||||
\x{37e}
|
||||
0: \x{37e}
|
||||
|
||||
/[^[:ascii:]\W]/8W
|
||||
a
|
||||
No match
|
||||
9
|
||||
No match
|
||||
g
|
||||
No match
|
||||
\x{100}
|
||||
0: \x{100}
|
||||
\x{200}
|
||||
0: \x{200}
|
||||
\x{300}
|
||||
No match
|
||||
\x{37e}
|
||||
No match
|
||||
|
||||
/[[:^ascii:]a]/8W
|
||||
a
|
||||
0: a
|
||||
9
|
||||
No match
|
||||
g
|
||||
No match
|
||||
\x{100}
|
||||
0: \x{100}
|
||||
\x{200}
|
||||
0: \x{200}
|
||||
\x{37e}
|
||||
0: \x{37e}
|
||||
|
||||
/-- End of testinput6 --/
|
||||
+55
-2
@@ -949,7 +949,7 @@ No match
|
||||
/[[:^alpha:][:^cntrl:]]+/8WBZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[ -~\x80-\xff\P{L}]++
|
||||
[ -~\x80-\xff\P{L}\x{100}-\x{10ffff}]++
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
@@ -961,7 +961,7 @@ No match
|
||||
/[[:^cntrl:][:^alpha:]]+/8WBZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[ -~\x80-\xff\P{L}]++
|
||||
[ -~\x80-\xff\x{100}-\x{10ffff}\P{L}]++
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
@@ -2295,4 +2295,57 @@ Need char = 'c' (caseless)
|
||||
scat
|
||||
0: sc
|
||||
|
||||
/[\W\p{Any}]/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[\x00-/:-@[-^`{-\xff\p{Any}]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
abc
|
||||
0: a
|
||||
123
|
||||
0: 1
|
||||
|
||||
/[\W\pL]/BZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[\x00-/:-@[-^`{-\xff\p{L}]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
abc
|
||||
0: a
|
||||
** Failers
|
||||
0: *
|
||||
123
|
||||
No match
|
||||
|
||||
/a[[:punct:]b]/WBZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
a
|
||||
[b[:punct:]]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/a[[:punct:]b]/8WBZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
a
|
||||
[b[:punct:]]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/a[b[:punct:]]/8WBZ
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
a
|
||||
[b[:punct:]]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
|
||||
/-- End of testinput7 --/
|
||||
+6
@@ -7785,4 +7785,10 @@ Matched, but offsets vector is too small to show all matches
|
||||
NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
|
||||
0: NON QUOTED "QUOT""ED" AFTER
|
||||
|
||||
/(?(?!)a|b)/
|
||||
bbb
|
||||
0: b
|
||||
aaa
|
||||
No match
|
||||
|
||||
/-- End of testinput8 --/
|
||||
+6
@@ -41,16 +41,22 @@ No match
|
||||
/^A\ˆ/
|
||||
A B
|
||||
0: A\x20
|
||||
A\x41B
|
||||
0: AA
|
||||
|
||||
/-- Test \H --/
|
||||
|
||||
/^A\È/
|
||||
AB
|
||||
0: AB
|
||||
A\x42B
|
||||
0: AB
|
||||
** Fail
|
||||
No match
|
||||
A B
|
||||
No match
|
||||
A\x41B
|
||||
No match
|
||||
|
||||
/-- Test \R --/
|
||||
|
||||
|
||||
+74
-74
@@ -136,7 +136,7 @@ static PHP_MINFO_FUNCTION(pcre)
|
||||
static PHP_MINIT_FUNCTION(pcre)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_SET_ORDER", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("PREG_OFFSET_CAPTURE", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -296,18 +296,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p = regex;
|
||||
|
||||
|
||||
/* Parse through the leading whitespace, and display a warning if we
|
||||
get to the end without encountering a delimiter. */
|
||||
while (isspace((int)*(unsigned char *)p)) p++;
|
||||
if (*p == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
p < regex + regex_len ? "Null byte in regex" : "Empty regular expression");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Get the delimiter and display a warning if it is alphanumeric
|
||||
or a backslash. */
|
||||
delimiter = *p++;
|
||||
@@ -360,7 +360,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Make a copy of the actual pattern. */
|
||||
pattern = estrndup(p, pp-p);
|
||||
|
||||
@@ -368,7 +368,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
pp++;
|
||||
|
||||
/* Parse through the options, setting appropriate flags. Display
|
||||
a warning if we encounter an unknown modifier. */
|
||||
a warning if we encounter an unknown modifier. */
|
||||
while (pp < regex + regex_len) {
|
||||
switch (*pp++) {
|
||||
/* Perl compatible options */
|
||||
@@ -376,7 +376,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
case 'm': coptions |= PCRE_MULTILINE; break;
|
||||
case 's': coptions |= PCRE_DOTALL; break;
|
||||
case 'x': coptions |= PCRE_EXTENDED; break;
|
||||
|
||||
|
||||
/* PCRE specific options */
|
||||
case 'A': coptions |= PCRE_ANCHORED; break;
|
||||
case 'D': coptions |= PCRE_DOLLAR_ENDONLY;break;
|
||||
@@ -389,12 +389,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
the PCRE_UCP option. */
|
||||
#ifdef PCRE_UCP
|
||||
coptions |= PCRE_UCP;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
/* Custom preg options */
|
||||
case 'e': poptions |= PREG_REPLACE_EVAL; break;
|
||||
|
||||
|
||||
case ' ':
|
||||
case '\n':
|
||||
break;
|
||||
@@ -474,7 +474,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
|
||||
* at end of request. However PCRE_G(pcre_cache) must be consistent
|
||||
* on the next request as well. So we disable usage of interned strings
|
||||
* as hash keys especually for this table.
|
||||
* See bug #63180
|
||||
* See bug #63180
|
||||
*/
|
||||
if (IS_INTERNED(regex)) {
|
||||
regex = tmp = estrndup(regex, regex_len);
|
||||
@@ -503,7 +503,7 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
if (preg_options) {
|
||||
*preg_options = pce ? pce->preg_options : 0;
|
||||
}
|
||||
|
||||
|
||||
return pce ? pce->re : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -513,7 +513,7 @@ PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *preg_
|
||||
PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *compile_options TSRMLS_DC)
|
||||
{
|
||||
pcre_cache_entry * pce = pcre_get_compiled_regex_cache(regex, strlen(regex) TSRMLS_CC);
|
||||
|
||||
|
||||
if (extra) {
|
||||
*extra = pce ? pce->extra : NULL;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *pr
|
||||
if (compile_options) {
|
||||
*compile_options = pce ? pce->compile_options : 0;
|
||||
}
|
||||
|
||||
|
||||
return pce ? pce->re : NULL;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -540,7 +540,7 @@ static inline void add_offset_pair(zval *result, char *str, int len, int offset,
|
||||
/* Add (match, offset) to the return value */
|
||||
add_next_index_stringl(match_pair, str, len, 1);
|
||||
add_next_index_long(match_pair, offset);
|
||||
|
||||
|
||||
if (name) {
|
||||
zval_add_ref(&match_pair);
|
||||
zend_hash_update(Z_ARRVAL_P(result), name, strlen(name)+1, &match_pair, sizeof(zval *), NULL);
|
||||
@@ -565,14 +565,14 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
|
||||
&subject, &subject_len, &subpats, &flags, &start_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
pce->refcount++;
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
php_pcre_match_impl(pce, subject, subject_len, return_value, subpats,
|
||||
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
|
||||
pce->refcount--;
|
||||
}
|
||||
@@ -676,7 +676,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
|
||||
matched = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
do {
|
||||
/* Execute the regular expression. */
|
||||
count = pcre_exec(pce->re, extra, subject, subject_len, start_offset,
|
||||
@@ -698,7 +698,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
/* If subpatterns array has been passed, fill it in with values. */
|
||||
if (subpats != NULL) {
|
||||
/* Try to get the list of substrings and display a warning if failed. */
|
||||
if (pcre_get_substring_list(subject, offsets, count, &stringlist) < 0) {
|
||||
if ((offsets[1] - offsets[0] < 0) || pcre_get_substring_list(subject, offsets, count, &stringlist) < 0) {
|
||||
efree(subpat_names);
|
||||
efree(offsets);
|
||||
if (match_sets) efree(match_sets);
|
||||
@@ -733,7 +733,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
ALLOC_ZVAL(result_set);
|
||||
array_init(result_set);
|
||||
INIT_PZVAL(result_set);
|
||||
|
||||
|
||||
/* Add all the subpatterns to it */
|
||||
for (i = 0; i < count; i++) {
|
||||
if (offset_capture) {
|
||||
@@ -787,13 +787,13 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
pcre_handle_exec_error(count TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
} while (global);
|
||||
@@ -810,7 +810,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
efree(match_sets);
|
||||
}
|
||||
|
||||
|
||||
efree(offsets);
|
||||
efree(subpat_names);
|
||||
|
||||
@@ -860,7 +860,7 @@ static int preg_get_backref(char **str, int *backref)
|
||||
walk++;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
|
||||
if (*walk && *walk >= '0' && *walk <= '9') {
|
||||
*backref = *backref * 10 + *walk - '0';
|
||||
walk++;
|
||||
@@ -872,9 +872,9 @@ static int preg_get_backref(char **str, int *backref)
|
||||
else
|
||||
walk++;
|
||||
}
|
||||
|
||||
|
||||
*str = walk;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -884,7 +884,7 @@ static int preg_do_repl_func(zval *function, char *subject, int *offsets, char *
|
||||
{
|
||||
zval *retval_ptr; /* Function return value */
|
||||
zval **args[1]; /* Argument to pass to function */
|
||||
zval *subpats; /* Captured subpatterns */
|
||||
zval *subpats; /* Captured subpatterns */
|
||||
int result_len; /* Return value length */
|
||||
int i;
|
||||
|
||||
@@ -935,11 +935,11 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
|
||||
int backref; /* Current backref */
|
||||
char *compiled_string_description;
|
||||
smart_str code = {0};
|
||||
|
||||
|
||||
eval_str_end = eval_str + eval_str_len;
|
||||
walk = segment = eval_str;
|
||||
walk_last = 0;
|
||||
|
||||
|
||||
while (walk < eval_str_end) {
|
||||
/* If found a backreference.. */
|
||||
if ('\\' == *walk || '$' == *walk) {
|
||||
@@ -992,15 +992,15 @@ static int preg_do_eval(char *eval_str, int eval_str_len, char *subject,
|
||||
}
|
||||
efree(compiled_string_description);
|
||||
convert_to_string(&retval);
|
||||
|
||||
|
||||
/* Save the return value and its length */
|
||||
*result = estrndup(Z_STRVAL(retval), Z_STRLEN(retval));
|
||||
result_len = Z_STRLEN(retval);
|
||||
|
||||
|
||||
/* Clean up */
|
||||
zval_dtor(&retval);
|
||||
smart_str_free(&code);
|
||||
|
||||
|
||||
return result_len;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1029,7 +1029,7 @@ PHPAPI char *php_pcre_replace(char *regex, int regex_len,
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_pcre_replace_impl() */
|
||||
PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val,
|
||||
PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *replace_val,
|
||||
int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC)
|
||||
{
|
||||
pcre_extra *extra = pce->extra;/* Holds results of studying */
|
||||
@@ -1105,7 +1105,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
}
|
||||
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
alloc_len = 2 * subject_len + 1;
|
||||
result = safe_emalloc(alloc_len, sizeof(char), 0);
|
||||
|
||||
@@ -1114,7 +1114,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
*result_len = 0;
|
||||
start_offset = 0;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
while (1) {
|
||||
/* Execute the regular expression. */
|
||||
count = pcre_exec(pce->re, extra, subject, subject_len, start_offset,
|
||||
@@ -1131,7 +1131,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
|
||||
piece = subject + start_offset;
|
||||
|
||||
if (count > 0 && (limit == -1 || limit > 0)) {
|
||||
if (count > 0 && (offsets[1] - offsets[0] >= 0) && (limit == -1 || limit > 0)) {
|
||||
if (replace_count) {
|
||||
++*replace_count;
|
||||
}
|
||||
@@ -1139,7 +1139,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
match = subject + offsets[0];
|
||||
|
||||
new_len = *result_len + offsets[0] - start_offset; /* part before the match */
|
||||
|
||||
|
||||
/* If evaluating, do it and add the return string's length */
|
||||
if (eval) {
|
||||
eval_result_len = preg_do_eval(replace, replace_len, subject,
|
||||
@@ -1184,7 +1184,7 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
|
||||
/* copy replacement and backrefs */
|
||||
walkbuf = result + *result_len;
|
||||
|
||||
|
||||
/* If evaluating or using custom function, copy result to the buffer
|
||||
* and clean up. */
|
||||
if (eval || is_callable_replace) {
|
||||
@@ -1254,13 +1254,13 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int sub
|
||||
result = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* If we have matched an empty string, mimic what Perl's /g options does.
|
||||
This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the next piece. */
|
||||
start_offset = offsets[1];
|
||||
}
|
||||
@@ -1284,18 +1284,18 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
*result;
|
||||
int subject_len;
|
||||
|
||||
/* Make sure we're dealing with strings. */
|
||||
/* Make sure we're dealing with strings. */
|
||||
convert_to_string_ex(subject);
|
||||
/* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */
|
||||
ZVAL_STRINGL(&empty_replace, "", 0, 0);
|
||||
|
||||
|
||||
/* If regex is an array */
|
||||
if (Z_TYPE_P(regex) == IS_ARRAY) {
|
||||
/* Duplicate subject string for repeated replacement */
|
||||
subject_value = estrndup(Z_STRVAL_PP(subject), Z_STRLEN_PP(subject));
|
||||
subject_len = Z_STRLEN_PP(subject);
|
||||
*result_len = subject_len;
|
||||
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(regex));
|
||||
|
||||
replace_value = replace;
|
||||
@@ -1304,9 +1304,9 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
|
||||
/* For each entry in the regex array, get the entry */
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_P(regex), (void **)®ex_entry) == SUCCESS) {
|
||||
/* Make sure we're dealing with strings. */
|
||||
/* Make sure we're dealing with strings. */
|
||||
convert_to_string_ex(regex_entry);
|
||||
|
||||
|
||||
/* If replace is an array and not a callable construct */
|
||||
if (Z_TYPE_P(replace) == IS_ARRAY && !is_callable_replace) {
|
||||
/* Get current entry */
|
||||
@@ -1321,7 +1321,7 @@ static char *php_replace_in_subject(zval *regex, zval *replace, zval **subject,
|
||||
replace_value = &empty_replace;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Do the actual replacement and put the result back into subject_value
|
||||
for further replacements. */
|
||||
if ((result = php_pcre_replace(Z_STRVAL_PP(regex_entry),
|
||||
@@ -1377,12 +1377,12 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
ulong num_key;
|
||||
char *callback_name;
|
||||
int replace_count=0, old_replace_count;
|
||||
|
||||
|
||||
/* Get function parameters and do error-checking. */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|lZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_callable_replace && Z_TYPE_PP(replace) == IS_ARRAY && Z_TYPE_PP(regex) != IS_ARRAY) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
|
||||
RETURN_FALSE;
|
||||
@@ -1408,10 +1408,10 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
if (ZEND_NUM_ARGS() > 3) {
|
||||
limit_val = limit;
|
||||
}
|
||||
|
||||
|
||||
if (Z_TYPE_PP(regex) != IS_ARRAY)
|
||||
convert_to_string_ex(regex);
|
||||
|
||||
|
||||
/* if subject is an array */
|
||||
if (Z_TYPE_PP(subject) == IS_ARRAY) {
|
||||
array_init(return_value);
|
||||
@@ -1439,7 +1439,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
efree(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(subject));
|
||||
}
|
||||
} else { /* if subject is not an array */
|
||||
@@ -1456,7 +1456,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||
zval_dtor(*zcount);
|
||||
ZVAL_LONG(*zcount, replace_count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1484,7 +1484,7 @@ static PHP_FUNCTION(preg_filter)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
|
||||
/* {{{ proto array preg_split(string pattern, string subject [, int limit [, int flags]])
|
||||
Split string into an array using a perl-style regular expression as a delimiter */
|
||||
static PHP_FUNCTION(preg_split)
|
||||
{
|
||||
@@ -1496,12 +1496,12 @@ static PHP_FUNCTION(preg_split)
|
||||
long flags = 0; /* Match control flags */
|
||||
pcre_cache_entry *pce; /* Compiled regular expression */
|
||||
|
||||
/* Get function parameters and do error checking */
|
||||
/* Get function parameters and do error checking */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", ®ex, ®ex_len,
|
||||
&subject, &subject_len, &limit_val, &flags) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
@@ -1538,7 +1538,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
no_empty = flags & PREG_SPLIT_NO_EMPTY;
|
||||
delim_capture = flags & PREG_SPLIT_DELIM_CAPTURE;
|
||||
offset_capture = flags & PREG_SPLIT_OFFSET_CAPTURE;
|
||||
|
||||
|
||||
if (limit_val == 0) {
|
||||
limit_val = -1;
|
||||
}
|
||||
@@ -1549,7 +1549,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
extra->match_limit = PCRE_G(backtrack_limit);
|
||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
||||
|
||||
|
||||
/* Initialize return value */
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1561,13 +1561,13 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
/* Start at the beginning of the string */
|
||||
start_offset = 0;
|
||||
next_offset = 0;
|
||||
last_match = subject;
|
||||
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
|
||||
|
||||
|
||||
/* Get next piece if no limit or limit not yet reached and something matched*/
|
||||
while ((limit_val == -1 || limit_val > 1)) {
|
||||
count = pcre_exec(pce->re, extra, subject,
|
||||
@@ -1582,9 +1582,9 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
php_error_docref(NULL TSRMLS_CC,E_NOTICE, "Matched, but too many substrings");
|
||||
count = size_offsets/3;
|
||||
}
|
||||
|
||||
|
||||
/* If something matched */
|
||||
if (count > 0) {
|
||||
if (count > 0 && (offsets[1] - offsets[0] >= 0)) {
|
||||
if (!no_empty || &subject[offsets[0]] != last_match) {
|
||||
|
||||
if (offset_capture) {
|
||||
@@ -1600,7 +1600,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
if (limit_val != -1)
|
||||
limit_val--;
|
||||
}
|
||||
|
||||
|
||||
last_match = &subject[offsets[1]];
|
||||
next_offset = offsets[1];
|
||||
|
||||
@@ -1657,7 +1657,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
the match again at the same point. If this fails (picked up above) we
|
||||
advance to the next character. */
|
||||
g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0;
|
||||
|
||||
|
||||
/* Advance to the position right after the last full match */
|
||||
start_offset = offsets[1];
|
||||
}
|
||||
@@ -1676,7 +1676,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Clean up */
|
||||
efree(offsets);
|
||||
}
|
||||
@@ -1697,13 +1697,13 @@ static PHP_FUNCTION(preg_quote)
|
||||
delim_char=0, /* Delimiter character to be quoted */
|
||||
c; /* Current character */
|
||||
zend_bool quote_delim = 0; /* Whether to quote additional delim char */
|
||||
|
||||
|
||||
/* Get the arguments and check for errors */
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &in_str, &in_str_len,
|
||||
&delim, &delim_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
in_str_end = in_str + in_str_len;
|
||||
|
||||
/* Nothing to do if we got an empty string */
|
||||
@@ -1715,11 +1715,11 @@ static PHP_FUNCTION(preg_quote)
|
||||
delim_char = delim[0];
|
||||
quote_delim = 1;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate enough memory so that even if each character
|
||||
is quoted, we won't run out of room */
|
||||
out_str = safe_emalloc(4, in_str_len, 1);
|
||||
|
||||
|
||||
/* Go through the string and quote necessary characters */
|
||||
for(p = in_str, q = out_str; p != in_str_end; p++) {
|
||||
c = *p;
|
||||
@@ -1763,7 +1763,7 @@ static PHP_FUNCTION(preg_quote)
|
||||
}
|
||||
}
|
||||
*q = '\0';
|
||||
|
||||
|
||||
/* Reallocate string and return it */
|
||||
RETVAL_STRINGL(erealloc(out_str, q - out_str + 1), q - out_str, 0);
|
||||
}
|
||||
@@ -1784,7 +1784,7 @@ static PHP_FUNCTION(preg_grep)
|
||||
&input, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Compile regex or get it from cache. */
|
||||
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
@@ -1809,9 +1809,9 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||
zend_bool invert; /* Whether to return non-matching
|
||||
entries */
|
||||
int rc;
|
||||
|
||||
|
||||
invert = flags & PREG_GREP_INVERT ? 1 : 0;
|
||||
|
||||
|
||||
if (extra == NULL) {
|
||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||
extra = &extra_data;
|
||||
@@ -1827,7 +1827,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||
}
|
||||
size_offsets = (size_offsets + 1) * 3;
|
||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||
|
||||
|
||||
/* Initialize return array */
|
||||
array_init(return_value);
|
||||
|
||||
@@ -1940,7 +1940,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, pattern)
|
||||
ZEND_ARG_INFO(0, subject)
|
||||
ZEND_ARG_INFO(0, limit)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_ARG_INFO(0, flags)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_quote, 0, 0, 1)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #70345 (Multiple vulnerabilities related to PCRE functions)
|
||||
--FILE--
|
||||
<?php
|
||||
$regex = '/(?=xyz\K)/';
|
||||
$subject = "aaaaxyzaaaa";
|
||||
|
||||
$v = preg_split($regex, $subject);
|
||||
print_r($v);
|
||||
|
||||
$regex = '/(a(?=xyz\K))/';
|
||||
$subject = "aaaaxyzaaaa";
|
||||
preg_match($regex, $subject, $matches);
|
||||
|
||||
var_dump($matches);
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => aaaaxyzaaaa
|
||||
)
|
||||
|
||||
Warning: preg_match(): Get subpatterns list failed in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
@@ -2261,6 +2261,10 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
|
||||
#endif
|
||||
int ext_len, free_filename = 0;
|
||||
|
||||
if (CHECK_NULL_PATH(filename, filename_len)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!strncasecmp(filename, "phar://", 7)) {
|
||||
filename += 7;
|
||||
filename_len -= 7;
|
||||
|
||||
@@ -561,13 +561,16 @@ static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char tmp[MAXPATHLEN];
|
||||
int tmp_len;
|
||||
size_t len;
|
||||
size_t len1, len2;
|
||||
|
||||
tmp_len = MIN(MAXPATHLEN, entry->filename_len + entry->phar->fname_len);
|
||||
len = MIN(entry->phar->fname_len, tmp_len);
|
||||
memcpy(tmp, entry->phar->fname, len);
|
||||
len = MIN(tmp_len - len, entry->filename_len);
|
||||
memcpy(tmp + entry->phar->fname_len, entry->filename, len);
|
||||
|
||||
len1 = MIN(entry->phar->fname_len, tmp_len);
|
||||
memcpy(tmp, entry->phar->fname, len1);
|
||||
|
||||
len2 = MIN(tmp_len - len1, entry->filename_len);
|
||||
memcpy(tmp + len1, entry->filename, len2);
|
||||
|
||||
entry->inode = (unsigned short)zend_get_hash_value(tmp, tmp_len);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+67
-24
@@ -478,7 +478,7 @@ PHP_METHOD(Phar, mount)
|
||||
int fname_len, arch_len, entry_len, path_len, actual_len;
|
||||
phar_archive_data **pphar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &path, &path_len, &actual, &actual_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ PHP_METHOD(Phar, createDefaultStub)
|
||||
int index_len = 0, webindex_len = 0;
|
||||
size_t stub_len;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|pp", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ PHP_METHOD(Phar, loadPhar)
|
||||
char *fname, *alias = NULL, *error;
|
||||
int fname_len, alias_len = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1083,7 @@ PHP_METHOD(Phar, isValidPharFilename)
|
||||
int fname_len, ext_len, is_executable;
|
||||
zend_bool executable = 1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &fname, &fname_len, &executable) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &fname, &fname_len, &executable) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1154,11 +1154,11 @@ PHP_METHOD(Phar, __construct)
|
||||
is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC);
|
||||
|
||||
if (is_data) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1326,7 +1326,7 @@ PHP_METHOD(Phar, unlinkArchive)
|
||||
int fname_len, zname_len, arch_len, entry_len;
|
||||
phar_archive_data *phar;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1756,7 +1756,7 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2628,7 +2628,7 @@ PHP_METHOD(Phar, delete)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -3440,7 +3440,7 @@ PHP_METHOD(Phar, copy)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3546,7 +3546,7 @@ PHP_METHOD(Phar, offsetExists)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3583,7 +3583,7 @@ PHP_METHOD(Phar, offsetGet)
|
||||
phar_entry_info *entry;
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3731,8 +3731,8 @@ PHP_METHOD(Phar, offsetSet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sr", &fname, &fname_len, &zresource) == FAILURE
|
||||
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "pr", &fname, &fname_len, &zresource) == FAILURE
|
||||
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3770,7 +3770,7 @@ PHP_METHOD(Phar, offsetUnset)
|
||||
return;
|
||||
}
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3817,7 +3817,7 @@ PHP_METHOD(Phar, addEmptyDir)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dirname, &dirname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &dirname, &dirname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3842,7 +3842,7 @@ PHP_METHOD(Phar, addFile)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3886,7 +3886,7 @@ PHP_METHOD(Phar, addFromString)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4117,6 +4117,9 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
char *fullpath;
|
||||
const char *slash;
|
||||
mode_t mode;
|
||||
cwd_state new_state;
|
||||
char *filename;
|
||||
size_t filename_len;
|
||||
|
||||
if (entry->is_mounted) {
|
||||
/* silently ignore mounted entries */
|
||||
@@ -4126,8 +4129,39 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (entry->filename_len >= sizeof(".phar")-1 && !memcmp(entry->filename, ".phar", sizeof(".phar")-1)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
/* strip .. from path and restrict it to be under dest directory */
|
||||
new_state.cwd = (char*)malloc(2);
|
||||
new_state.cwd[0] = DEFAULT_SLASH;
|
||||
new_state.cwd[1] = '\0';
|
||||
new_state.cwd_length = 1;
|
||||
if (virtual_file_ex(&new_state, entry->filename, NULL, CWD_EXPAND TSRMLS_CC) != 0 ||
|
||||
new_state.cwd_length <= 1) {
|
||||
if (EINVAL == errno && entry->filename_len > 50) {
|
||||
char *tmp = estrndup(entry->filename, 50);
|
||||
spprintf(error, 4096, "Cannot extract \"%s...\" to \"%s...\", extracted filename is too long for filesystem", tmp, dest);
|
||||
efree(tmp);
|
||||
} else {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", internal error", entry->filename);
|
||||
}
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
filename = new_state.cwd + 1;
|
||||
filename_len = new_state.cwd_length - 1;
|
||||
#ifdef PHP_WIN32
|
||||
/* unixify the path back, otherwise non zip formats might be broken */
|
||||
{
|
||||
int cnt = filename_len;
|
||||
|
||||
len = spprintf(&fullpath, 0, "%s/%s", dest, entry->filename);
|
||||
do {
|
||||
if ('\\' == filename[cnt]) {
|
||||
filename[cnt] = '/';
|
||||
}
|
||||
} while (cnt-- >= 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
len = spprintf(&fullpath, 0, "%s/%s", dest, filename);
|
||||
|
||||
if (len >= MAXPATHLEN) {
|
||||
char *tmp;
|
||||
@@ -4141,18 +4175,21 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem", entry->filename, fullpath);
|
||||
}
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (!len) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", internal error", entry->filename);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (PHAR_OPENBASEDIR_CHECKPATH(fullpath)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", openbasedir/safe mode restrictions in effect", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -4160,14 +4197,15 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (!overwrite && SUCCESS == php_stream_stat_path(fullpath, &ssb)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\" to \"%s\", path already exists", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* perform dirname */
|
||||
slash = zend_memrchr(entry->filename, '/', entry->filename_len);
|
||||
slash = zend_memrchr(filename, '/', filename_len);
|
||||
|
||||
if (slash) {
|
||||
fullpath[dest_len + (slash - entry->filename) + 1] = '\0';
|
||||
fullpath[dest_len + (slash - filename) + 1] = '\0';
|
||||
} else {
|
||||
fullpath[dest_len] = '\0';
|
||||
}
|
||||
@@ -4177,23 +4215,27 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
|
||||
if (!php_stream_mkdir(fullpath, entry->flags & PHAR_ENT_PERM_MASK, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", could not create directory \"%s\"", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (!php_stream_mkdir(fullpath, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL)) {
|
||||
spprintf(error, 4096, "Cannot extract \"%s\", could not create directory \"%s\"", entry->filename, fullpath);
|
||||
efree(fullpath);
|
||||
free(new_state.cwd);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slash) {
|
||||
fullpath[dest_len + (slash - entry->filename) + 1] = '/';
|
||||
fullpath[dest_len + (slash - filename) + 1] = '/';
|
||||
} else {
|
||||
fullpath[dest_len] = '/';
|
||||
}
|
||||
|
||||
filename = NULL;
|
||||
free(new_state.cwd);
|
||||
/* it is a standalone directory, job done */
|
||||
if (entry->is_dir) {
|
||||
efree(fullpath);
|
||||
@@ -4271,7 +4313,7 @@ PHP_METHOD(Phar, extractTo)
|
||||
|
||||
PHAR_ARCHIVE_OBJECT();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4410,7 +4452,7 @@ PHP_METHOD(PharFileInfo, __construct)
|
||||
phar_archive_data *phar_data;
|
||||
zval *zobj = getThis(), arg1;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4842,6 +4884,7 @@ PHP_METHOD(PharFileInfo, getContent)
|
||||
|
||||
phar_seek_efp(link, 0, SEEK_SET, 0, 0 TSRMLS_CC);
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
Z_STRVAL_P(return_value) = NULL;
|
||||
Z_STRLEN_P(return_value) = php_stream_copy_to_mem(fp, &(Z_STRVAL_P(return_value)), link->uncompressed_filesize, 0);
|
||||
|
||||
if (!Z_STRVAL_P(return_value)) {
|
||||
|
||||
+19
-6
@@ -195,6 +195,13 @@ static int phar_tar_process_metadata(phar_entry_info *entry, php_stream *fp TSRM
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if !HAVE_STRNLEN
|
||||
static size_t strnlen(const char *s, size_t maxlen) {
|
||||
char *r = (char *)memchr(s, '\0', maxlen);
|
||||
return r ? r-s : maxlen;
|
||||
}
|
||||
#endif
|
||||
|
||||
int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char buf[512], *actual_alias = NULL, *p;
|
||||
@@ -204,6 +211,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
|
||||
php_uint32 sum1, sum2, size, old;
|
||||
phar_archive_data *myphar, **actual;
|
||||
int last_was_longlink = 0;
|
||||
int linkname_len;
|
||||
|
||||
if (error) {
|
||||
*error = NULL;
|
||||
@@ -264,7 +272,7 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
|
||||
goto next;
|
||||
}
|
||||
|
||||
if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
|
||||
if (((!old && hdr->prefix[0] == 0) || old) && strnlen(hdr->name, 100) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
|
||||
off_t curloc;
|
||||
|
||||
if (size > 511) {
|
||||
@@ -474,20 +482,22 @@ bail:
|
||||
}
|
||||
|
||||
entry.link = NULL;
|
||||
|
||||
/* link field is null-terminated unless it has 100 non-null chars.
|
||||
* Thus we can not use strlen. */
|
||||
linkname_len = strnlen(hdr->linkname, 100);
|
||||
if (entry.tar_type == TAR_LINK) {
|
||||
if (!zend_hash_exists(&myphar->manifest, hdr->linkname, strlen(hdr->linkname))) {
|
||||
if (!zend_hash_exists(&myphar->manifest, hdr->linkname, linkname_len)) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file - hard link to non-existent file \"%s\"", fname, hdr->linkname);
|
||||
spprintf(error, 4096, "phar error: \"%s\" is a corrupted tar file - hard link to non-existent file \"%.*s\"", fname, linkname_len, hdr->linkname);
|
||||
}
|
||||
pefree(entry.filename, entry.is_persistent);
|
||||
php_stream_close(fp);
|
||||
phar_destroy_phar_data(myphar TSRMLS_CC);
|
||||
return FAILURE;
|
||||
}
|
||||
entry.link = estrdup(hdr->linkname);
|
||||
entry.link = estrndup(hdr->linkname, linkname_len);
|
||||
} else if (entry.tar_type == TAR_SYMLINK) {
|
||||
entry.link = estrdup(hdr->linkname);
|
||||
entry.link = estrndup(hdr->linkname, linkname_len);
|
||||
}
|
||||
phar_set_inode(&entry TSRMLS_CC);
|
||||
zend_hash_add(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), (void **) &newentry);
|
||||
@@ -880,6 +890,9 @@ static int phar_tar_setupmetadata(void *pDest, void *argument TSRMLS_DC) /* {{{
|
||||
|
||||
if (entry->filename_len >= sizeof(".phar/.metadata") && !memcmp(entry->filename, ".phar/.metadata", sizeof(".phar/.metadata")-1)) {
|
||||
if (entry->filename_len == sizeof(".phar/.metadata.bin")-1 && !memcmp(entry->filename, ".phar/.metadata.bin", sizeof(".phar/.metadata.bin")-1)) {
|
||||
if (entry->phar->metadata == NULL) {
|
||||
return ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
return phar_tar_setmetadata(entry->phar->metadata, entry, error TSRMLS_CC);
|
||||
}
|
||||
/* search for the file this metadata entry references */
|
||||
|
||||
@@ -126,19 +126,19 @@ echo $e->getMessage() . "\n";
|
||||
--EXPECTF--
|
||||
Warning: Phar::mungServer() expects parameter 1 to be array, %string given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::createDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::loadPhar() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::canCompress() expects parameter 1 to be long, %string given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::__construct() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: PharData::delete() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
Cannot write out phar archive, phar is read-only
|
||||
Entry oops does not exist and cannot be deleted
|
||||
%sfiles/frontcontroller10.phar
|
||||
@@ -165,18 +165,18 @@ Phar is readonly, cannot change compression
|
||||
Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
Cannot copy "a" to "b", phar is read-only
|
||||
|
||||
Warning: Phar::offsetExists() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::offsetGet() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: PharData::offsetUnset() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
Write operations disabled by the php.ini setting phar.readonly
|
||||
|
||||
Warning: Phar::addEmptyDir() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::addFile() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
|
||||
Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
|
||||
|
||||
Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
|
||||
Write operations disabled by the php.ini setting phar.readonly
|
||||
|
||||
@@ -48,11 +48,12 @@ try {
|
||||
<?php
|
||||
@unlink(__DIR__."/bug64931.phar");
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Test
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
CAUGHT: Cannot create any files in magic ".phar" directory
|
||||
===DONE===
|
||||
|
||||
Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s%ebug64931.php on line %d
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Phar - bug #69720 - Null pointer dereference in phar_get_fp_offset()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
// open an existing phar
|
||||
$p = new Phar(__DIR__."/bug69720.phar",0);
|
||||
// Phar extends SPL's DirectoryIterator class
|
||||
echo $p->getMetadata();
|
||||
foreach (new RecursiveIteratorIterator($p) as $file) {
|
||||
// $file is a PharFileInfo class, and inherits from SplFileInfo
|
||||
$temp="";
|
||||
$temp= $file->getFileName() . "\n";
|
||||
$temp.=file_get_contents($file->getPathName()) . "\n"; // display contents
|
||||
var_dump($file->getMetadata());
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo 'Could not open Phar: ', $e;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
MY_METADATA_NULL
|
||||
|
||||
Warning: file_get_contents(phar:///%s): failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d
|
||||
array(1) {
|
||||
["whatever"]=>
|
||||
int(123)
|
||||
}
|
||||
object(DateTime)#2 (3) {
|
||||
["date"]=>
|
||||
string(26) "2000-01-01 00:00:00.000000"
|
||||
["timezone_type"]=>
|
||||
int(3)
|
||||
["timezone"]=>
|
||||
string(3) "UTC"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #70019 Files extracted from archive may be placed outside of destination directory
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar") || !extension_loaded('zlib')) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dir = __DIR__."/bug70019";
|
||||
$phar = new PharData(__DIR__."/bug70019.zip");
|
||||
if(!is_dir($dir)) {
|
||||
mkdir($dir);
|
||||
}
|
||||
$phar->extractTo($dir);
|
||||
var_dump(file_exists("$dir/ThisIsATestFile.txt"));
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
$dir = __DIR__."/bug70019";
|
||||
unlink("$dir/ThisIsATestFile.txt");
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
===DONE===
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Phar - bug #70433 - Uninitialized pointer in phar_make_dirstream when zip entry filename is "/"
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar") || !extension_loaded("zlib")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$phar = new PharData(__DIR__."/bug70433.zip");
|
||||
var_dump($phar);
|
||||
$meta = $phar->getMetadata();
|
||||
var_dump($meta);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
object(PharData)#1 (3) {
|
||||
["pathName":"SplFileInfo":private]=>
|
||||
string(0) ""
|
||||
["glob":"DirectoryIterator":private]=>
|
||||
bool(false)
|
||||
["subPathName":"RecursiveDirectoryIterator":private]=>
|
||||
string(0) ""
|
||||
}
|
||||
NULL
|
||||
DONE
|
||||
Executable
BIN
Binary file not shown.
Loaded 100 of 190 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user