SIO2Arduino icon indicating copy to clipboard operation
SIO2Arduino copied to clipboard

Possible bug in ATX image handling code

Open ksuszka opened this issue 3 years ago • 0 comments

I was skimming through code and caught something which may be a bug. In line https://github.com/whizzosoftware/SIO2Arduino/blob/45fd906432909930cee5e15c75b89022238a5a0f/disk_image.cpp#L317 (and in 3 additional places down the file) there is a 32 bit number decoded from four bytes, I think it sould be change into something like:

fileIndex = file->read() + file->read() * 256 + file->read() * 256*256 + file->read() * 256*256*256;

or

fileIndex = file->read() + file->read() * (1 << 8) + file->read() * (1 << 16) + file->read() * (1 << 24);

ksuszka avatar Apr 12 '22 22:04 ksuszka