from typing import List


def fix_mtcnn_bb(max_y: int, max_x: int, bounding_box: List[int]) -> List[int]:
    """ mtcnn results can be out of image so fix results
    """
    x1, y1, dx, dy = bounding_box[:4]
    x2 = x1 + dx
    y2 = y1 + dy
    x1 = max(min(x1, max_x), 0)
    x2 = max(min(x2, max_x), 0)
    y1 = max(min(y1, max_y), 0)
    y2 = max(min(y2, max_y), 0)
    return [x1, y1, x2, y2]