Fix out-of-range integer brng reading past brng_list - #177
Open
vchamarthi wants to merge 1 commit into
Open
vchamarthi wants to merge 1 commit into
vchamarthi wants to merge 1 commit into
Conversation
vchamarthi
requested review from
antonwolfy,
jharlow-intel,
ndgrigorian,
vlad-perevezentsev and
xaleryb
as code owners
September 17, 2026 15:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
brng_listhasBRNG_KINDS= 11 entries,irk_brng_tdefines 0–10. The integerpath of
_parse_brng_token_coerced the user value straight toirk_brng_t, whichonly checks it fits the enum's underlying integer type. The seeding routines then
index
brng_list[brng].brng=11returned uninitialized memory, no warning, no error:brng=15raised an oneMKL error;brng=-1was accepted as a negative index.Separately,
if (brng):treatedbrng=0as unset, but0isMT19937:How found
Coverity Scan CID 653949,
OVERRUN: "Overrunning callee's array of size 11 bypassing argument
__pyx_v_brng_token(which evaluates to 15) in call toirk_randomseed_mkl". Confirmed againstrandomkit.h:50,randomkit.cpp:111andthe
.pyxcall path, then reproduced per-process on a build ofmaster. Thebrng=0bug surfaced while writing the boundary test.Distinct from the
_seed_implOUT_OF_BOUNDSfinding already dismissed incoverity/README.md, which is the tuple unpack and is a false positive.Fix
BRNG_KINDSfromrandomkit.hso the bound tracks the C table.MT19937,as an unrecognized generator name already does.
brng is not Noneinstead of truthiness, sobrng=0is honoured.Tests
5 out-of-range values assert warn plus fallback;
0and10assert accepted,silent, and equal to the same generator selected by name.