[apps/shared] Prevent Array index overflow

Change-Id: I67ffcb71d0d62a3e67e6d63d2b30b0696800cb42
This commit is contained in:
Hugo Saint-Vignes
2020-10-29 17:05:24 +01:00
committed by Émilie Feral
parent fe950386a0
commit 8dc6391e92

View File

@@ -233,7 +233,7 @@ T Sequence::approximateToNextRank(int n, SequenceContext * sqctx, int sequenceIn
int offset = independentRank - sqctx->independentSequenceRank<T>(i);
if (offset != 0) {
for (int j = MaxRecurrenceDepth; j >= 0; j--) {
values[i][j] = j-offset < 0 ? NAN : sqctx->independentSequenceValue<T>(i, j-offset);
values[i][j] = j-offset < 0 || j-offset > MaxRecurrenceDepth ? NAN : sqctx->independentSequenceValue<T>(i, j-offset);
}
}
} else {