Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Reproduction:
>>>import_sre>>>_sre.compile('',0, ['abc'],0, {}, ())Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>OverflowError:regularexpressioncodesizelimitexceeded
It should be:
>>>import_sre>>>_sre.compile('',0, ['abc'],0, {}, ())Traceback (mostrecentcalllast):File"<stdin>",line1,in<module>TypeError:anintegerisrequired
Because the third arg iscode: object(subclass_of='&PyList_Type'), it is assumed to be integers inside.
Problematic lines:
Lines 1510 to 1515 indef7ea5
| unsigned longvalue=PyLong_AsUnsignedLong(o); | |
| self->code[i]= (SRE_CODE)value; | |
| if ((unsigned long)self->code[i]!=value) { | |
| PyErr_SetString(PyExc_OverflowError, | |
| "regular expression code size limit exceeded"); | |
| break; |
They do not check forPyLong_AsUnsignedLong errors.
I have a PR ready :)