Hello ArkProject,
The function cairoStringPack uses inline assembly to access and manipulate memory (mload(add(strBytes, offset))
). There is a risk that the offset
value might exceed the length of strBytes
, especially when the string length is less than the expected 32 bytes (0x20). This could lead to out-of-bounds memory access, resulting in incorrect data being packed or potentially triggering a contract crash.
Specifically, the loop increases offset
by CAIRO_STR_LEN
(31), which is not necessarily aligned to 32 bytes, and the assembly code shifts the value by 8 bits (shr(8, v)
), which assumes that the string is a multiple of 32 bytes, but this might not always be true.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.