• Jeffrey Lee's avatar
    Reject overly-large discs, and other invalid things · eb3e3485
    Jeffrey Lee authored
    Detail:
      c/Accessors, h/Accessors, Makefile - Added some simple 'image accessor' routines to abstract over accessing the underlying disc/image file. These accept 64bit disc addresses and will check to make sure any size limits imposed by the lower-level API are adhered to (512MB limit for FileCore_DiscOp, or extent of image file for OS_GBPB)
      h/MsgTrans, Resources/Germany/Messages, Resources/UK/Messages - Add a couple of new error messages
      h/Helpers - Add a couple of macros to simplify reading 16/32bit values that are split into multiple bytes in struct definitions. Change writeWORD & loadWORD to accept void* instead of char* so they can be used with other types like 'byte'
      h/DOSshape - Add '0' suffix to some struct members so they can be used with new READ_0123 macro
      h/ADFSshape - Make sure put_doublestep is safe to use with bools
      c/DOSdirs - Remove pointless malloc of small temporary array
      c/DOSclusters - Use new READ_ macros in max_sector()
      c/DOSFS - Use new READ_ macros so code is less painful to read. Use new image accessor system to get rid of some boilerplate for reading from the disc (+ extra error checks). Change 32bit values to 64bit where it looks like it's necessary, and use bools in place of a couple of 0/1 ints. Reject any discs which are too big for the 32bit fields in the ADFS disc record.
      c/OpsFunc - Update DOSFS_image_open in ways similar to the code in c/DOSFS, making use of READ_, image accessor, 64bit values, and adding extra error checks.
    Admin:
      Tested with assorted large & small image files & SD cards on a BB-xM, and some DOS/Atari floppy discs on a RiscPC
      FAT partitions larger than 4GB (or which extend past the 4GB FileSwitch limit) are now rejected, as are image files which have been truncated
      A future improvement could be to lift the disc/partition identification code out of c/DOSFS and c/OpsFunc and unify it, since both files contain fairly similar code
      German messages are in need of translation
    
    
    Version 1.12. Tagged as 'DOSFS-1_12'
    eb3e3485
Accessors 2.93 KB