Ticket #13401: 0001-ext2-Volume-check-some-more-value-for-ext2_super_blo.patch

File 0001-ext2-Volume-check-some-more-value-for-ext2_super_blo.patch, 1.3 KB (added by wangxindsb, 8 years ago)
  • src/add-ons/kernel/file_systems/ext2/Volume.cpp

    From 264f3b2be220e3cbad5edf25427de4dd768ca062 Mon Sep 17 00:00:00 2001
    From: wangxindsb <“wangxindsb@gmail.com”>
    Date: Thu, 30 Mar 2017 20:32:12 -0700
    Subject: [PATCH] ext2 Volume: check some more value for ext2_super_block
    
    ---
     src/add-ons/kernel/file_systems/ext2/Volume.cpp | 11 ++---------
     1 file changed, 2 insertions(+), 9 deletions(-)
    
    diff --git a/src/add-ons/kernel/file_systems/ext2/Volume.cpp b/src/add-ons/kernel/file_systems/ext2/Volume.cpp
    index 3b59251..c115081 100644
    a b ext2_super_block::IsValid()  
    207207            || BlocksPerGroup() != (1UL << BlockShift()) * 8
    208208            || InodeSize() > (1UL << BlockShift())
    209209            || RevisionLevel() > EXT2_MAX_REVISION
    210             || ReservedGDTBlocks() > (1UL << BlockShift()) / 4)
     210            || ReservedGDTBlocks() > (1UL << BlockShift()) / 4
     211            || GroupDescriptorSize() > EXT2_BLOCK_GROUP_64BIT_SIZE || GroupDescriptorSize() < EXT2_BLOCK_GROUP_NORMAL_SIZE)
    211212        return false;
    212     if (Has64bitFeature()) {
    213         if (GroupDescriptorSize() > EXT2_BLOCK_GROUP_64BIT_SIZE  || GroupDescriptorSize() < EXT2_BLOCK_GROUP_NORMAL_SIZE)
    214             return false;
    215     }
    216     else {
    217         if (GroupDescriptorSize() != EXT2_BLOCK_GROUP_NORMAL_SIZE)
    218             return false;
    219     }
    220213   
    221214    return true;
    222215}