def check_image_size_incorrect(self):
        ''' Checking if the reported image size matches the actual image size '''
        last_virtual_address = 0
        last_virtual_size = 0

        section_alignment = self.pefile_handle.OPTIONAL_HEADER.SectionAlignment
        total_image_size = self.pefile_handle.OPTIONAL_HEADER.SizeOfImage

        for section in self.pefile_handle.sections:
            if section.VirtualAddress > last_virtual_address:
                last_virtual_address = section.VirtualAddress
                last_virtual_size = section.Misc_VirtualSize

        # Just pad the size to be equal to the alignment and check for mismatch
        last_virtual_size += section_alignment - (last_virtual_size % section_alignment)
        if (last_virtual_address + last_virtual_size) != total_image_size:
            return {'description': 'Image size does not match reported size', 
                    'severity': 3, 'category': 'MALFORMED'}

        return None
Checking if the reported image size matches the actual image size