Alex Herbert created RNG-202:
--------------------------------
Summary: Scaling factors in GuideTableDiscreteSampler and
AliasMethodDiscreteSampler allow very large memory allocation
Key: RNG-202
URL: https://issues.apache.org/jira/browse/RNG-202
Project: Commons RNG
Issue Type: Improvement
Components: sampling
Affects Versions: 1.7
Reporter: Alex Herbert
The GuideTableDiscreteSampler and AliasMethodDiscreteSampler sample an
enumerated distribution of {{n}} categories defined by probabilities.
The GuideTableDiscreteSampler allocates a guide table of length {{n * alpha}},
where {{alpha}} is a scaling factor.
The AliasMethodDiscreteSampler allocates alias tables using the size {{n}}. The
input probabilities may be padded using a factor {{alpha}} to increase the
table size by 2^alpha and then rounded to the next power of 2.
In both samplers there is no limit on the increase in size made by the scaling
factor. This allows construction to be bounded by the maximum memory allocation
of an array.
Issue identified using a security scan.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)