Skip to content

Commit 921832b

Browse files
committed
Fix #310: Matrix index out of bounds.
1 parent 832ceff commit 921832b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/query/clip/clip_aabb_line.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ pub fn clip_aabb_line(
137137

138138
if near_side < 0 {
139139
normal[(-near_side - 1) as usize] = 1.0;
140-
} else {
140+
} else if near_side > 0 {
141141
normal[(near_side - 1) as usize] = -1.0;
142+
} else {
143+
return None;
142144
}
143145

144146
(tmin, normal, near_side)
@@ -151,8 +153,10 @@ pub fn clip_aabb_line(
151153

152154
if far_side < 0 {
153155
normal[(-far_side - 1) as usize] = -1.0;
154-
} else {
156+
} else if far_side > 0 {
155157
normal[(far_side - 1) as usize] = 1.0;
158+
} else {
159+
return None;
156160
}
157161

158162
(tmax, normal, far_side)

0 commit comments

Comments
 (0)