From 47eaacff061b21cc9d9105dabce3247db47a8a96 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 23 Jan 2025 02:10:39 +0100 Subject: [PATCH] Update Python/marshal.c Co-authored-by: Sergey B Kirpichev --- Python/marshal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/marshal.c b/Python/marshal.c index 696995cd27acbe..aef6580b4a61a3 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -257,6 +257,8 @@ _r_digits##bitsize(const uint ## bitsize ## _t *digits, Py_ssize_t n, \ Py_ssize_t l = (n - 1)*marshal_ratio; \ uint ## bitsize ## _t d = digits[n - 1]; \ \ + assert(marshal_ratio > 0); \ + assert(n >= 1); \ assert(d != 0); /* a PyLong is always normalized */ \ do { \ d >>= PyLong_MARSHAL_SHIFT; \