Skip to content

Commit 62cedef

Browse files
committed
Avoid undefined behavior from reading uninitialized data
1 parent 2ab7be3 commit 62cedef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

regex_macros/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ fn exec<'t>(
309309

310310
#[inline]
311311
fn contains(&self, pc: usize) -> bool {
312-
let s = self.sparse[pc];
312+
let s = unsafe { ::std::ptr::read_volatile(&self.sparse[pc]) };
313313
s < self.size && self.dense[s].pc == pc
314314
}
315315

0 commit comments

Comments
 (0)