Skip to content

Commit bf37180

Browse files
authored
Merge pull request #1855 from Zentrik/oob
Fix out of bounds access in `quartiles`
2 parents 35426c3 + ae78ae8 commit bf37180

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

site/src/comparison.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,9 @@ impl HistoricalData {
12461246
}
12471247

12481248
let len = pcs.len();
1249-
let (h1_end, h2_begin) = if len % 2 == 0 {
1249+
let (h1_end, h2_begin) = if len <= 2 {
1250+
(0, std::cmp::min(len, 1))
1251+
} else if len % 2 == 0 {
12501252
(len / 2 - 2, len / 2 + 1)
12511253
} else {
12521254
(len / 2 - 1, len / 2 + 1)

0 commit comments

Comments
 (0)