Skip to content

Commit

Permalink
Fix possible out of bound read in armv8_crc32c
Browse files Browse the repository at this point in the history
  • Loading branch information
w4123 committed Jan 16, 2025
1 parent 5a73626 commit b539af9
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit b539af9

Please sign in to comment.