summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-06-20 16:13:39 (GMT)
committerGitHub <noreply@github.com>2022-06-20 16:13:39 (GMT)
commit1603a1029f44f0fdc87c65b02063229962194f84 (patch)
tree151e7d71bead44cec4375b283ff03e5e92390bf6 /Objects/codeobject.c
parentcfb986a1a239f1a00af745a53235b8473b1bd54a (diff)
downloadcpython-1603a1029f44f0fdc87c65b02063229962194f84.zip
cpython-1603a1029f44f0fdc87c65b02063229962194f84.tar.gz
cpython-1603a1029f44f0fdc87c65b02063229962194f84.tar.bz2
GH-93249: relax overly strict assertion on bounds->ar_start (GH-93961)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index c1f696d..707de11 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -826,6 +826,11 @@ next_code_delta(PyCodeAddressRange *bounds)
static int
previous_code_delta(PyCodeAddressRange *bounds)
{
+ if (bounds->ar_start == 0) {
+ // If we looking at the first entry, the
+ // "previous" entry has an implicit length of 1.
+ return 1;
+ }
const uint8_t *ptr = bounds->opaque.lo_next-1;
while (((*ptr) & 128) == 0) {
ptr--;
@@ -869,7 +874,7 @@ static void
retreat(PyCodeAddressRange *bounds)
{
ASSERT_VALID_BOUNDS(bounds);
- assert(bounds->ar_start > 0);
+ assert(bounds->ar_start >= 0);
do {
bounds->opaque.lo_next--;
} while (((*bounds->opaque.lo_next) & 128) == 0);