SimEng icon indicating copy to clipboard operation
SimEng copied to clipboard

readlinkat writes path in 256 byte chunks

Open jrprice opened this issue 5 years ago • 1 comments

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.

jrprice avatar Nov 09 '19 05:11 jrprice

Given the large overhaul in multi-thread-support with how syscalls are emulated, this fix will be added to this branch

FinnWilkinson avatar Jun 07 '23 11:06 FinnWilkinson