diff options
-rw-r--r-- | Modules/stropmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index e9e9039..73c2d85 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c @@ -1091,6 +1091,10 @@ strop_replace(self, args) &str, &len, &pat, &pat_len, &sub, &sub_len, &count)) return NULL; + if (pat_len <= 0) { + PyErr_SetString(PyExc_ValueError, "empty pattern string"); + return NULL; + } new_s = mymemreplace(str,len,pat,pat_len,sub,sub_len,count,&out_len); if (new_s == NULL) { PyErr_NoMemory(); |