summaryrefslogtreecommitdiff
path: root/ext/mbstring/mbstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/mbstring.c')
-rw-r--r--ext/mbstring/mbstring.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 5618d7a75b..57e438429d 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -5074,7 +5074,21 @@ static inline zend_long php_mb_ord(const char* str, size_t str_len, const char*
return -1;
}
- ret = php_mb_convert_encoding(str, str_len, "UCS-4BE", enc, &ret_len);
+ {
+ long orig_illegalchars = MBSTRG(illegalchars);
+ MBSTRG(illegalchars) = 0;
+ ret = php_mb_convert_encoding(str, str_len, "UCS-4BE", enc, &ret_len);
+ if (MBSTRG(illegalchars) != 0) {
+ if (ret) {
+ efree(ret);
+ }
+ MBSTRG(illegalchars) = orig_illegalchars;
+ return -1;
+ }
+
+ MBSTRG(illegalchars) = orig_illegalchars;
+ }
+
if (ret == NULL) {
return -1;
}