mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Fix overflow detection when setting single level DDT v2.
This commit is contained in:
@@ -1100,11 +1100,8 @@ bool set_ddt_single_level_v2(aaruformatContext *ctx, uint64_t sector_address, co
|
|||||||
const uint64_t block_index = block_offset >> ctx->userDataDdtHeader.blockAlignmentShift;
|
const uint64_t block_index = block_offset >> ctx->userDataDdtHeader.blockAlignmentShift;
|
||||||
*ddt_entry = offset & (1ULL << ctx->userDataDdtHeader.dataShift) - 1 | block_index
|
*ddt_entry = offset & (1ULL << ctx->userDataDdtHeader.dataShift) - 1 | block_index
|
||||||
<< ctx->userDataDdtHeader.dataShift;
|
<< ctx->userDataDdtHeader.dataShift;
|
||||||
}
|
|
||||||
|
|
||||||
if(ctx->userDataDdtHeader.sizeType == SmallDdtSizeType)
|
if(ctx->userDataDdtHeader.sizeType == SmallDdtSizeType)
|
||||||
{
|
{ // Overflow detection for DDT entry
|
||||||
// Overflow detection for DDT entry
|
|
||||||
if(*ddt_entry > 0xFFF)
|
if(*ddt_entry > 0xFFF)
|
||||||
{
|
{
|
||||||
FATAL("DDT overflow: media does not fit in small DDT");
|
FATAL("DDT overflow: media does not fit in small DDT");
|
||||||
@@ -1113,7 +1110,6 @@ bool set_ddt_single_level_v2(aaruformatContext *ctx, uint64_t sector_address, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
*ddt_entry |= (uint64_t)sector_status << 12;
|
*ddt_entry |= (uint64_t)sector_status << 12;
|
||||||
ctx->cachedSecondaryDdtSmall[sector_address] = (uint16_t)*ddt_entry;
|
|
||||||
}
|
}
|
||||||
else if(ctx->userDataDdtHeader.sizeType == BigDdtSizeType)
|
else if(ctx->userDataDdtHeader.sizeType == BigDdtSizeType)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user