Previous 15994 Revisions Next

r6784 Sunday 27th December, 2009 at 08:19:45 UTC by Jonathan Gevaryahu
Fix out of array bound access when writing to apple 2 disk images [Skito]
[src/mess/formats]ap2_dsk.c

src/mess/formats/ap2_dsk.c
r6783r6784
340340      else
341341      {
342342         /* 3 * 2 bit */
343         if (i + 0x00 < APPLE2_SECTOR_SIZE)
344            data[i + 0x00] = ((newvalue >> 1) & 0x01) | ((newvalue << 1) & 0x02);
345         if (i + 0x56 < APPLE2_SECTOR_SIZE)
346            data[i + 0x56] = ((newvalue >> 3) & 0x01) | ((newvalue >> 1) & 0x02);
343         data[i + 0x00] = ((newvalue >> 1) & 0x01) | ((newvalue << 1) & 0x02);
344         data[i + 0x56] = ((newvalue >> 3) & 0x01) | ((newvalue >> 1) & 0x02);
347345         if (i + 0xAC < APPLE2_SECTOR_SIZE)
348346            data[i + 0xAC] = ((newvalue >> 5) & 0x01) | ((newvalue >> 3) & 0x02);
349347      }
r6783r6784
435433         oldvalue |= (data[i + 0x00] & 0x02) >> 1;
436434         oldvalue |= (data[i + 0x56] & 0x01) << 3;
437435         oldvalue |= (data[i + 0x56] & 0x02) << 1;
438         oldvalue |= (data[i + 0xAC] & 0x01) << 5;
439         oldvalue |= (data[i + 0xAC] & 0x02) << 3;
436         if (i + 0xAC < APPLE2_SECTOR_SIZE)
437         {
438            oldvalue |= (data[i + 0xAC] & 0x01) << 5;
439            oldvalue |= (data[i + 0xAC] & 0x02) << 3;
440         }
441
440442      }
441443      xorvalue ^= oldvalue;
442444      nibble[28+i] = translate6[xorvalue & 0x3F];

Previous 15994 Revisions Next


© 1998-2018 The MESS Team