-
-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null character breaks regex patterns #10592
Comments
e.g. `new EReg("abc\x00def", "")` would erroneously match "abc" HaxeFoundation/haxe#10592
* [regex] Update pcre to pcre2 * [regex] Throw if accessing match after match error * [regex] Prevent null character breaking patterns e.g. `new EReg("abc\x00def", "")` would erroneously match "abc" HaxeFoundation/haxe#10592 * [regex] Add TODO regarding pcre2_substitute * [cmake] Fix static Apache build We can no longer link pcre as we use pcre2 * [cmake] Fix windows pcre static build * [cmake] Download old PCRE for Apache * [cmake] Remove unused flag for pcre windows build * [cmake] Reenable PCRE_STATIC cmake flag for Win * [cmake] Use https for pcre download for Apache Co-authored-by: Simon Krajewski <[email protected]>
The Php issue is a Php bug so I think it's fine to leave it. There is already way to avoid the bug by escaping it or by using Haxe's regex literal syntax, which escapes it automatically. On Hashlink it is a little bit more complicated however, as according to this page: https://haxe.org/manual/std-String-encoding.html, Hashlink does not support null bytes, so I'm not sure whether it makes sense or not to fix this there. Also, it would potentially require a change of the Hashlink api to pass in the length of the pattern into the constructor. |
* [regex] Update pcre to pcre2 * [regex] Throw if accessing match after match error * [regex] Prevent null character breaking patterns e.g. `new EReg("abc\x00def", "")` would erroneously match "abc" HaxeFoundation/haxe#10592 * [regex] Add TODO regarding pcre2_substitute * [cmake] Fix static Apache build We can no longer link pcre as we use pcre2 * [cmake] Fix windows pcre static build * [cmake] Download old PCRE for Apache * [cmake] Remove unused flag for pcre windows build * [cmake] Reenable PCRE_STATIC cmake flag for Win * [cmake] Use https for pcre download for Apache Co-authored-by: Simon Krajewski <[email protected]> # Conflicts: # Earthfile # README.md # extra/azure-pipelines/Brewfile-STATIC_DEPS_NONE # libs/CMakeLists.txt
When a regex pattern created directly using the constructor that contains a null character, it does not match properly on Eval, Neko, C++, lua, and Hashlink. PHP throws an error on the first match call due of the null character (
Null byte in regex
).On all other targets it works as expected.
On the other hand, the following works fine on (almost) all targets, where we use the regex literal syntax.
Targets affected:
PHPdue to a PHP bugThe text was updated successfully, but these errors were encountered: