File php72-pspell-do-not-allow-ucs.patch of Package php72.14048
Index: php-5.3.17/ext/pspell/pspell.c
===================================================================
--- php-5.3.17.orig/ext/pspell/pspell.c 2012-09-12 23:27:16.000000000 +0200
+++ php-5.3.17/ext/pspell/pspell.c 2020-02-05 16:31:27.824650828 +0100
@@ -316,7 +316,16 @@ static PHP_FUNCTION(pspell_new)
}
if (encoding_len) {
- pspell_config_replace(config, "encoding", encoding);
+ if (strcasecmp(encoding, "ucs-2") ||
+ strcasecmp(encoding, "ucs-4") ||
+ strcasecmp(encoding, "machine unsigned 16") ||
+ strcasecmp(encoding, "machine unsigned 32") ||
+ strcasecmp(encoding, "utf-16") ||
+ strcasecmp(encoding, "utf-32")) {
+ php_error_docref(NULL, E_WARNING, "PSPELL does not support UCS-2 and UCS-4");
+ } else {
+ pspell_config_replace(config, "encoding", encoding);
+ }
}
if (argc > 4) {
@@ -431,7 +440,16 @@ static PHP_FUNCTION(pspell_new_personal)
}
if (encoding_len) {
- pspell_config_replace(config, "encoding", encoding);
+ if (strcasecmp(encoding, "ucs-2") ||
+ strcasecmp(encoding, "ucs-4") ||
+ strcasecmp(encoding, "machine unsigned 16") ||
+ strcasecmp(encoding, "machine unsigned 32") ||
+ strcasecmp(encoding, "utf-16") ||
+ strcasecmp(encoding, "utf-32")) {
+ php_error_docref(NULL, E_WARNING, "PSPELL does not support UCS-2 and UCS-4");
+ } else {
+ pspell_config_replace(config, "encoding", encoding);
+ }
}
if (argc > 5) {
@@ -745,7 +763,16 @@ static PHP_FUNCTION(pspell_config_create
}
if (encoding_len) {
- pspell_config_replace(config, "encoding", encoding);
+ if (strcasecmp(encoding, "ucs-2") ||
+ strcasecmp(encoding, "ucs-4") ||
+ strcasecmp(encoding, "machine unsigned 16") ||
+ strcasecmp(encoding, "machine unsigned 32") ||
+ strcasecmp(encoding, "utf-16") ||
+ strcasecmp(encoding, "utf-32")) {
+ php_error_docref(NULL, E_WARNING, "PSPELL does not support UCS-2 and UCS-4");
+ } else {
+ pspell_config_replace(config, "encoding", encoding);
+ }
}
/* By default I do not want to write anything anywhere because it'll try to write to $HOME