File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -512,21 +512,24 @@ impl AssetBundle {
512512 } ) ;
513513 }
514514
515- // The LZMA_alone encoder does not write the correct
516- // buffer sizes to the headers, so sub them in.
515+ // The LZMA_alone encoder does not write the correct buffer sizes
516+ // to the headers (it writes all 0xFFs) , so sub them in.
517517 for i in 0 ..self . levels . len ( ) {
518518 let level_start = if i == 0 {
519519 0
520520 } else {
521521 level_ends[ i - 1 ] . compressed_end
522522 } ;
523+
523524 let level_size_uncompressed = level_sizes_uncompressed[ i] ;
524525 let level_size_uncompressed_start = ( level_start
525526 + 1 // properties byte
526527 + 4 ) // dict size
527528 as usize ;
528- buf[ level_size_uncompressed_start..level_size_uncompressed_start + 8 ]
529- . copy_from_slice ( & ( level_size_uncompressed) . to_le_bytes ( ) ) ;
529+
530+ let slice = & mut buf[ level_size_uncompressed_start..level_size_uncompressed_start + 8 ] ;
531+ assert ! ( slice == [ 0xFF ; 8 ] ) ;
532+ slice. copy_from_slice ( & level_size_uncompressed. to_le_bytes ( ) ) ;
530533 }
531534
532535 let header = AssetBundleHeader :: new ( level_ends) ;
You can’t perform that action at this time.
0 commit comments