We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e30ba1 commit 8cfd0c0Copy full SHA for 8cfd0c0
Python/compile.c
@@ -6605,9 +6605,14 @@ static int
6605
assemble_emit_linetable_pair(struct assembler *a, int bdelta, int ldelta)
6606
{
6607
Py_ssize_t len = PyBytes_GET_SIZE(a->a_lnotab);
6608
- if (a->a_lnotab_off + 2 >= len) {
6609
- if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0)
+ if (a->a_lnotab_off >= len - 2) {
+ if (len > PY_SSIZE_T_MAX / 2) {
6610
+ PyErr_NoMemory();
6611
+ return 0;
6612
+ }
6613
+ if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) {
6614
return 0;
6615
6616
}
6617
unsigned char *lnotab = (unsigned char *) PyBytes_AS_STRING(a->a_lnotab);
6618
lnotab += a->a_lnotab_off;
0 commit comments