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 possible out of bound read in armv8_crc32c #2293

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions sys/libkern/arm64/crc32c_armv8.S
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ ENTRY(armv8_crc32c)
cbz w2, end
tbz x1, #0x0, half_word_aligned
sub w2, w2, 0x1
ldr w10, [PTR(1)], #0x1
ldrb w10, [PTR(1)], #0x1
crc32cb w0, w0, w10
half_word_aligned:
cmp w2, #0x2
b.lo last_byte
tbz x1, #0x1, word_aligned
sub w2, w2, 0x2
ldr w10, [PTR(1)], #0x2
ldrh w10, [PTR(1)], #0x2
crc32ch w0, w0, w10
word_aligned:
cmp w2, #0x4
Expand All @@ -69,11 +69,11 @@ last_word:
crc32cw w0, w0, w10
last_half_word:
tbz w2, #0x1, last_byte
ldr w10, [PTR(1)], #0x2
ldrh w10, [PTR(1)], #0x2
crc32ch w0, w0, w10
last_byte:
tbz w2, #0x0, end
ldr w10, [PTR(1)], #0x1
ldrb w10, [PTR(1)], #0x1
crc32cb w0, w0, w10
end:
ret
Expand Down