From: Mark Shannon Date: Thu, 1 May 2025 10:02:51 +0000 (+0100) Subject: PyStats: Make sure that the `failure_kinds` array is big enough. (#133245) X-Git-Tag: v3.14.0b1~147 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3831752689f4a43c26746b691c9c904550fadc17;p=thirdparty%2FPython%2Fcpython.git PyStats: Make sure that the `failure_kinds` array is big enough. (#133245) --- diff --git a/Include/cpython/pystats.h b/Include/cpython/pystats.h index 7c1459bde8f1..20eb969a9bac 100644 --- a/Include/cpython/pystats.h +++ b/Include/cpython/pystats.h @@ -31,7 +31,7 @@ #define PYSTATS_MAX_UOP_ID 512 -#define SPECIALIZATION_FAILURE_KINDS 50 +#define SPECIALIZATION_FAILURE_KINDS 60 /* Stats for determining who is calling PyEval_EvalFrame */ #define EVAL_CALL_TOTAL 0 diff --git a/Python/specialize.c b/Python/specialize.c index 562e4a19d64a..f4b06918e687 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -440,7 +440,9 @@ _Py_PrintSpecializationStats(int to_file) #define SPECIALIZATION_FAIL(opcode, kind) \ do { \ if (_Py_stats) { \ - _Py_stats->opcode_stats[opcode].specialization.failure_kinds[kind]++; \ + int _kind = (kind); \ + assert(_kind < SPECIALIZATION_FAILURE_KINDS); \ + _Py_stats->opcode_stats[opcode].specialization.failure_kinds[_kind]++; \ } \ } while (0)