Qualcomm Interview Question

how to avoid overflow in FIFO design; design a FSM for bit string detect