Fix EDC retrieval by using memcpy for correct data access

This commit is contained in:
2025-10-08 19:21:14 +01:00
parent 102ef6a1b7
commit 0d53c988ad

View File

@@ -984,7 +984,8 @@ int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool neg
if(form2) if(form2)
{ {
const uint32_t computed_edc = aaruf_edc_cd_compute(context, 0, data, 0x91C, 0x10); const uint32_t computed_edc = aaruf_edc_cd_compute(context, 0, data, 0x91C, 0x10);
const uint32_t edc = *(data + 0x92C); uint32_t edc = 0;
memcpy(&edc, data + 0x92C, sizeof(edc));
const bool correct_edc = computed_edc == edc; const bool correct_edc = computed_edc == edc;
if(correct_edc) if(correct_edc)
@@ -1027,7 +1028,8 @@ int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool neg
const bool correct_ecc = aaruf_ecc_cd_is_suffix_correct_mode2(context, data); const bool correct_ecc = aaruf_ecc_cd_is_suffix_correct_mode2(context, data);
const uint32_t computed_edc = aaruf_edc_cd_compute(context, 0, data, 0x808, 0x10); const uint32_t computed_edc = aaruf_edc_cd_compute(context, 0, data, 0x808, 0x10);
const uint32_t edc = *(data + 0x818); uint32_t edc = 0;
memcpy(&edc, data + 0x818, sizeof(edc));
const bool correct_edc = computed_edc == edc; const bool correct_edc = computed_edc == edc;
if(correct_ecc && correct_edc) if(correct_ecc && correct_edc)