Skip to content

Commit

Permalink
adfReconstructBitmap: make the checks of bmPages arrays entries beyon…
Browse files Browse the repository at this point in the history
…d the nominal size optional and disable them by default.
  • Loading branch information
t-w committed Dec 12, 2023
1 parent cfb11f2 commit 974fa86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/adf_bitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ RETCODE adfReconstructBitmap ( struct AdfVolume * const vol,

/* check for erratic (?) (non-zero) entries in bmpages beyond the expected size,
more info: https://github.com/lclevy/ADFlib/issues/63 */
#if CHECK_NONZERO_BMPAGES_BEYOND_BMSIZE == 1
for ( uint32_t i2 = i ; i2 < BM_PAGES_ROOT_SIZE ; i2++ ) {
if ( root->bmPages[i2] != 0 )
adfEnv.wFct ( "adfReconstructBitmap: a non-zero (%u, 0x%02x) entry in rootblock "
Expand All @@ -347,9 +348,12 @@ RETCODE adfReconstructBitmap ( struct AdfVolume * const vol,
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// -> REPAIR INSTEAD (?) -> JUST SET TO 0
//
#endif

SECTNUM bmExtSect = root->bmExt;
#if CHECK_NONZERO_BMPAGES_BEYOND_BMSIZE == 1
unsigned bmExt_i = 0;
#endif
while ( bmExtSect != 0 ) {
struct bBitmapExtBlock bmExtBlock;

Expand Down Expand Up @@ -380,6 +384,7 @@ RETCODE adfReconstructBitmap ( struct AdfVolume * const vol,

/* check for erratic (?) (non-zero) entries in bmpages beyond the expected size,
more info: https://github.com/lclevy/ADFlib/issues/63 */
#if CHECK_NONZERO_BMPAGES_BEYOND_BMSIZE == 1
for ( uint32_t i2 = i ; i2 < BM_PAGES_EXT_SIZE ; i2++ ) {
if ( bmExtBlock.bmPages[i2] != 0 )
adfEnv.wFct (
Expand All @@ -393,6 +398,7 @@ RETCODE adfReconstructBitmap ( struct AdfVolume * const vol,
vol->bitmap.size );
}
bmExt_i++;
#endif

bmExtSect = bmExtBlock.nextBlock;
}
Expand Down

0 comments on commit 974fa86

Please sign in to comment.