Skip to content

Commit baec3c9

Browse files
committed
gh-151022: Tighten linetable parsing bounds
1 parent 464aedb commit baec3c9

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Modules/_remote_debugging/code_objects.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
#include "_remote_debugging.h"
99

10-
#define MAX_LINETABLE_SIZE (1024 * 1024)
11-
#define MAX_LINETABLE_ENTRIES 65536
10+
#define MAX_LINETABLE_SIZE (64 * 1024)
1211

1312
/* ============================================================================
1413
* TLBC CACHING FUNCTIONS (Py_GIL_DISABLED only)
@@ -189,10 +188,7 @@ parse_linetable(const uintptr_t addrq, const char* linetable, Py_ssize_t linetab
189188
int computed_line = firstlineno; // Running accumulator, separate from output
190189
int val; // Temporary for varint results
191190
uint8_t byte; // Temporary for byte reads
192-
size_t entry_count = 0;
193-
194-
while (ptr < end && *ptr != '\0' && entry_count < MAX_LINETABLE_ENTRIES) {
195-
entry_count++;
191+
while (ptr < end && *ptr != '\0') {
196192
uint8_t first_byte = *(ptr++);
197193
uint8_t code = (first_byte >> 3) & 15;
198194
size_t length = (first_byte & 7) + 1;

0 commit comments

Comments
 (0)