[
https://issues.apache.org/jira/browse/NUMBERS-213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert resolved NUMBERS-213.
----------------------------------
Fix Version/s: 1.4
Assignee: Alex Herbert
Resolution: Fixed
Fixed in commit:
7d6f68ea13253804c0a809f13b83a9ca0b84932c
> Selection on a sub-range silently modifies signed-zero data outside
> [fromIndex, toIndex)
> ----------------------------------------------------------------------------------------
>
> Key: NUMBERS-213
> URL: https://issues.apache.org/jira/browse/NUMBERS-213
> Project: Commons Numbers
> Issue Type: Bug
> Components: arrays
> Affects Versions: 1.3
> Reporter: Alex Herbert
> Assignee: Alex Herbert
> Priority: Minor
> Fix For: 1.4
>
>
> Selection on double data counts and then removes signs from zeros within the
> range {{{}[fromIndex, toIndex){}}}. The count of negatively signed zeros are
> then restored after processing.
> This begins from the start of the array and not the {{fromIndex}} position
> and can silently modify zeros outside the target range, and not restore
> signed zeros inside the range:
>
> {code:java}
> double[] a = {0.0, 0.0, -0.0};
> int from = 1;
> int to = 3;
> int k = 1;
> Selection.select(a, from, to, k);
> // Expected: {0.0, -0.0, 0.0}
> // Actual: {-0.0, 0.0, 0.0} <-- modifies outside [1, 3).
> Inside [1, 3) has no signed zeros.{code}
> Issue identified using a security scan.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)