Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix OOB arithmetic in ASCII encoding #54

Merged
merged 2 commits into from
Aug 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ macro_rules! basic_latin_alu {
let dst_until_alignment = (ALU_ALIGNMENT
- ((dst as usize) & ALU_ALIGNMENT_MASK))
& ALU_ALIGNMENT_MASK;
if (src.add(dst_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
if (src.wrapping_add(dst_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
break;
}
dst_until_alignment
Expand Down Expand Up @@ -291,7 +291,7 @@ macro_rules! latin1_alu {
let src_until_alignment = (ALU_ALIGNMENT
- ((src as usize) & ALU_ALIGNMENT_MASK))
& ALU_ALIGNMENT_MASK;
if (dst.add(src_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
if (dst.wrapping_add(src_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
break;
}
src_until_alignment
Expand All @@ -300,7 +300,7 @@ macro_rules! latin1_alu {
let dst_until_alignment = (ALU_ALIGNMENT
- ((dst as usize) & ALU_ALIGNMENT_MASK))
& ALU_ALIGNMENT_MASK;
if (src.add(dst_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
if (src.wrapping_add(dst_until_alignment) as usize) & ALU_ALIGNMENT_MASK != 0 {
break;
}
dst_until_alignment
Expand Down