SimEng
SimEng copied to clipboard
readlinkat writes path in 256 byte chunks
The loop at the end of the readlinkat
implementation writes the resulting path back to memory in 256 byte chunks:
for (size_t i = 0; i < bytesCopied; i += 256) {
uint8_t size = std::min<uint64_t>(bytesCopied - i, 256ul);
..
The size of a memory access is stored in a uint8_t
however, which cannot represent the value 256
(it'll wrap to 0). The chunk size should probably be reduced to either 128 or 64.
Given the large overhaul in multi-thread-support
with how syscalls are emulated, this fix will be added to this branch