mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Avoid core dump on symcomp("").
This commit is contained in:
parent
6602099e7c
commit
ab28c56fd3
1 changed files with 5 additions and 1 deletions
|
@ -398,6 +398,11 @@ symcomp(pattern, gdict)
|
|||
object *npattern;
|
||||
int require_escape = re_syntax & RE_NO_BK_PARENS ? 0 : 1;
|
||||
|
||||
if (oend == opat) {
|
||||
INCREF(pattern);
|
||||
return pattern;
|
||||
}
|
||||
|
||||
npattern = newsizedstringobject((char*)NULL, getstringsize(pattern));
|
||||
if (npattern == NULL)
|
||||
return NULL;
|
||||
|
@ -466,7 +471,6 @@ symcomp(pattern, gdict)
|
|||
if (resizestring(&npattern, n - getstringvalue(npattern)) == 0)
|
||||
return npattern;
|
||||
else {
|
||||
DECREF(npattern);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue