From e290c30301ac908bfcbf572a0f1e2dbfa3b01cbf Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 10 Aug 2026 13:28:10 -0700 Subject: Myriad header fix for small block sizes. The header stream pre-allocate was too small when the block size was too small. --- src/stable/myriad.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stable/myriad.cpp b/src/stable/myriad.cpp index 53250c2..d564b70 100644 --- a/src/stable/myriad.cpp +++ b/src/stable/myriad.cpp @@ -384,7 +384,7 @@ bool Bu::Myriad::loadMyriad() // We need to read enough so that we can gurantee that we're within a block // that we have read the index to, plus one index. - for( int32_t j = 0; j < iHeaderStreamBlocks; j++ ) + for( int32_t j = 0; ; j++ ) { int32_t iBlockIndex; MyriadRead( &iBlockIndex, 4 ); @@ -455,8 +455,8 @@ void Bu::Myriad::createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ) int iHeaderStreamBlocks = blkDiv(iHeaderStreamBytes+4, iBlockSize ); //Bu::println("Initial estimate: %1 bytes / %2 cur blocks, %3 computed blocks (%4 target bytes).").arg( iHeaderStreamBytes+(iHeaderStreamBlocks*4) ).arg( iHeaderStreamBlocks ).arg( blkDiv((iHeaderStreamBytes+(iHeaderStreamBlocks*4)), iBlockSize) ).arg( iHeaderStreamBlocks*iBlockSize ); - while( iHeaderStreamBytes+(iHeaderStreamBlocks*4) - > iHeaderStreamBlocks*iBlockSize ) + while( iHeaderStreamBytes+(iHeaderStreamBlocks*4)+4 + >= iHeaderStreamBlocks*iBlockSize ) { iHeaderStreamBlocks = blkDiv((iHeaderStreamBytes+((iHeaderStreamBlocks+1)*4)), iBlockSize); if( iHeaderStreamBlocks > 100 ) -- cgit v1.2.3