def test_dos_header_attack(art_warning, fix_get_synthetic_data, fix_make_dummy_model):
    """
    Test the DOS header attack modifies the correct regions
    """
    # 5th check: DOS header attack
    try:
        param_dic = {"maxlen": 2**20, "input_dim": 257, "embedding_size": 8}
        # First check: with no perturbation the malware of sufficient size, and benign files, should be unperturbed
        l0_budget = 290
        attack = MalwareGDTensorFlow(
            classifier=fix_make_dummy_model[0],
            embedding_weights=fix_make_dummy_model[1],
            l_0=l0_budget,
            param_dic=param_dic,
        )
        x = np.copy(fix_get_synthetic_data[0])
        y = np.copy(fix_get_synthetic_data[1])
        size_of_files = np.copy(fix_get_synthetic_data[2])

        dos_starts, dos_sizes = attack.get_dos_locations(x)

        adv_x, adv_y, adv_sizes, batch_of_section_starts, batch_of_section_sizes = attack.pull_out_valid_samples(
            x, y, sample_sizes=size_of_files, perturb_starts=dos_starts, perturb_sizes=dos_sizes
        )

        # should have 3 files. Samples which are excluded are:
        #   2nd datapoint (file too large to support any modifications)
        #   5th datapoint (benign file)

        assert len(adv_x) == 3

        adv_x = attack.generate(
            adv_x, adv_y, adv_sizes, perturb_sizes=batch_of_section_sizes, perturb_starts=batch_of_section_starts
        )

        j = 0
        for i in range(len(fix_get_synthetic_data[2])):
            if i in [0, 2, 3]:
                assert np.array_equal(adv_x[j, 0:2], [77, 90])

                # we should have 58 bytes that were perturbed between the magic number and the pointer
                assert not np.array_equal(adv_x[j, 2 : int(0x3C)], fix_get_synthetic_data[0][i, 2 : int(0x3C)])

                # dummy pointer should be unchanged
                assert np.array_equal(adv_x[j, int(0x3C) : int(0x3C) + 4], [44, 1, 0, 0])

                # the remaining perturbation 290 - 58 = 232 is in the rest of the DOS header
                assert not np.array_equal(
                    adv_x[j, int(0x3C) + 4 : int(0x3C) + 4 + 232],
                    fix_get_synthetic_data[0][i, int(0x3C) + 4 : int(0x3C) + 4 + 232],
                )

                # rest of the file is unchanged
                assert np.array_equal(
                    adv_x[j, int(0x3C) + 4 + 232 :], fix_get_synthetic_data[0][i, int(0x3C) + 4 + 232 :]
                )
                j += 1
    except ARTTestException as e:
        art_warning(e)

    Test the DOS header attack modifies the correct regions
    
tests/attacks/evasion/test_pe_malware_attack.py