Program: 5531
Project: 5531
Buggy source:
public void receivedByte(byte data){
  if (DEBUG)   log("String_Node_Str" + Utils.hex8(data) + "String_Node_Str"+ stateMachine+ "String_Node_Str"+ zeroSymbols+ ((stateMachine == RadioState.RX_SFD_SEARCH || stateMachine == RadioState.RX_FRAME) ? "String_Node_Str" : "String_Node_Str"));
  if (stateMachine == RadioState.RX_SFD_SEARCH) {
    if (data == 0) {
      zeroSymbols++;
    }
 else     if (zeroSymbols >= 4 && data == 0x7A) {
      setSFD(true);
      if (DEBUG)       log("String_Node_Str");
      setState(RadioState.RX_FRAME);
    }
 else {
      zeroSymbols=0;
    }
  }
 else   if (stateMachine == RadioState.RX_FRAME) {
    if (overflow) {
    }
 else     if (rxFIFO.isFull()) {
      setRxOverflow();
    }
 else {
      if (!frameRejected) {
        rxFIFO.write(data);
        if (rxread == 0) {
          rxCrc.setCRC(0);
          rxlen=data & 0xff;
          decodeAddress=addressDecode;
          if (DEBUG)           log("String_Node_Str" + rxlen);
          setFIFO(true);
        }
 else         if (rxread < rxlen - 1) {
          rxCrc.addBitrev(data & 0xff);
          if (rxread == 1) {
            fcf0=data & 0xff;
            frameType=fcf0 & FRAME_TYPE;
          }
 else           if (rxread == 2) {
            fcf1=data & 0xff;
            if (frameType == TYPE_DATA_FRAME) {
              ackRequest=(fcf0 & ACK_REQUEST) > 0;
              destinationAddressMode=(fcf1 >> 2) & 3;
              if (addressDecode && destinationAddressMode != LONG_ADDRESS && destinationAddressMode != SHORT_ADDRESS) {
                rejectFrame();
              }
            }
 else             if (frameType == TYPE_BEACON_FRAME || frameType == TYPE_ACK_FRAME) {
              decodeAddress=false;
              ackRequest=false;
            }
 else             if (addressDecode) {
              rejectFrame();
            }
          }
 else           if (rxread == 3) {
            dsn=data & 0xff;
          }
 else           if (decodeAddress) {
            boolean flushPacket=false;
            if (destinationAddressMode == LONG_ADDRESS && rxread == 8 + 5) {
              flushPacket=!rxFIFO.tailEquals(memory,RAM_IEEEADDR,8);
              flushPacket|=!rxFIFO.tailEquals(memory,RAM_PANID,2,8) && !rxFIFO.tailEquals(BC_ADDRESS,0,2,8);
              decodeAddress=false;
            }
 else             if (destinationAddressMode == SHORT_ADDRESS && rxread == 2 + 5) {
              flushPacket=!rxFIFO.tailEquals(BC_ADDRESS,0,2) && !rxFIFO.tailEquals(memory,RAM_SHORTADDR,2);
              flushPacket|=!rxFIFO.tailEquals(memory,RAM_PANID,2,2) && !rxFIFO.tailEquals(BC_ADDRESS,0,2,2);
              decodeAddress=false;
            }
            if (flushPacket) {
              rejectFrame();
            }
          }
        }
        if (fifoP == false && rxFIFO.length() <= rxlen + 1 && !decodeAddress && !frameRejected && rxFIFO.length() > fifopThr) {
          setFIFOP(true);
          if (DEBUG)           log("String_Node_Str");
        }
      }
      if (rxread++ == rxlen) {
        if (frameRejected) {
          if (DEBUG)           log("String_Node_Str");
          setSFD(false);
          setState(RadioState.RX_WAIT);
          return;
        }
        int crc=rxFIFO.get(-2) << 8;
        crc+=rxFIFO.get(-1);
        crcOk=crc == rxCrc.getCRCBitrev();
        if (DEBUG && !crcOk) {
          log("String_Node_Str" + Utils.hex16(crc) + "String_Node_Str"+ Utils.hex16(rxCrc.getCRCBitrev()));
        }
        rxFIFO.set(-2,registers[REG_RSSI] & 0xff);
        rxFIFO.set(-1,37 | (crcOk ? 0x80 : 0));
        if (rxFIFO.length() <= rxlen + 1) {
          setFIFOP(true);
        }
 else {
          if (DEBUG)           log("String_Node_Str" + rxFIFO.length() + "String_Node_Str"+ rxlen);
        }
        setSFD(false);
        if (DEBUG)         log("String_Node_Str" + rxFIFO.stateToString());
        if (((autoAck && ackRequest) || shouldAck) && crcOk) {
          setState(RadioState.TX_ACK_CALIBRATE);
        }
 else {
          setState(RadioState.RX_WAIT);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void receivedByte(byte data){
  if (DEBUG)   log("String_Node_Str" + Utils.hex8(data) + "String_Node_Str"+ stateMachine+ "String_Node_Str"+ zeroSymbols+ ((stateMachine == RadioState.RX_SFD_SEARCH || stateMachine == RadioState.RX_FRAME) ? "String_Node_Str" : "String_Node_Str"));
  if (stateMachine == RadioState.RX_SFD_SEARCH) {
    if (data == 0) {
      zeroSymbols++;
    }
 else     if (zeroSymbols >= 4 && data == 0x7A) {
      setSFD(true);
      if (DEBUG)       log("String_Node_Str");
      setState(RadioState.RX_FRAME);
    }
 else {
      zeroSymbols=0;
    }
  }
 else   if (stateMachine == RadioState.RX_FRAME) {
    if (overflow) {
    }
 else     if (rxFIFO.isFull()) {
      setRxOverflow();
    }
 else {
      if (!frameRejected) {
        rxFIFO.write(data);
        if (rxread == 0) {
          rxCrc.setCRC(0);
          rxlen=data & 0xff;
          decodeAddress=addressDecode;
          if (DEBUG)           log("String_Node_Str" + rxlen);
          setFIFO(true);
        }
 else         if (rxread < rxlen - 1) {
          rxCrc.addBitrev(data & 0xff);
          if (rxread == 1) {
            fcf0=data & 0xff;
            frameType=fcf0 & FRAME_TYPE;
          }
 else           if (rxread == 2) {
            fcf1=data & 0xff;
            if (frameType == TYPE_DATA_FRAME) {
              ackRequest=(fcf0 & ACK_REQUEST) > 0;
              destinationAddressMode=(fcf1 >> 2) & 3;
              if (addressDecode && destinationAddressMode != LONG_ADDRESS && destinationAddressMode != SHORT_ADDRESS) {
                rejectFrame();
              }
            }
 else             if (frameType == TYPE_BEACON_FRAME || frameType == TYPE_ACK_FRAME) {
              decodeAddress=false;
              ackRequest=false;
            }
 else             if (addressDecode) {
              rejectFrame();
            }
          }
 else           if (rxread == 3) {
            dsn=data & 0xff;
          }
 else           if (decodeAddress) {
            boolean flushPacket=false;
            if (destinationAddressMode == LONG_ADDRESS && rxread == 8 + 5) {
              flushPacket=!rxFIFO.tailEquals(memory,RAM_IEEEADDR,8);
              flushPacket|=!rxFIFO.tailEquals(memory,RAM_PANID,2,8) && !rxFIFO.tailEquals(BC_ADDRESS,0,2,8);
              decodeAddress=false;
            }
 else             if (destinationAddressMode == SHORT_ADDRESS && rxread == 2 + 5) {
              flushPacket=!rxFIFO.tailEquals(BC_ADDRESS,0,2) && !rxFIFO.tailEquals(memory,RAM_SHORTADDR,2);
              flushPacket|=!rxFIFO.tailEquals(memory,RAM_PANID,2,2) && !rxFIFO.tailEquals(BC_ADDRESS,0,2,2);
              decodeAddress=false;
            }
            if (flushPacket) {
              rejectFrame();
            }
          }
        }
        if (currentFIFOP == false && rxFIFO.length() <= rxlen + 1 && !decodeAddress && !frameRejected && rxFIFO.length() > fifopThr) {
          setFIFOP(true);
          if (DEBUG)           log("String_Node_Str");
        }
      }
      if (rxread++ == rxlen) {
        if (frameRejected) {
          if (DEBUG)           log("String_Node_Str");
          setSFD(false);
          setState(RadioState.RX_WAIT);
          return;
        }
        int crc=rxFIFO.get(-2) << 8;
        crc+=rxFIFO.get(-1);
        crcOk=crc == rxCrc.getCRCBitrev();
        if (DEBUG && !crcOk) {
          log("String_Node_Str" + Utils.hex16(crc) + "String_Node_Str"+ Utils.hex16(rxCrc.getCRCBitrev()));
        }
        rxFIFO.set(-2,registers[REG_RSSI] & 0xff);
        rxFIFO.set(-1,37 | (crcOk ? 0x80 : 0));
        if (rxFIFO.length() <= rxlen + 1) {
          setFIFOP(true);
        }
 else {
          if (DEBUG)           log("String_Node_Str" + rxFIFO.length() + "String_Node_Str"+ rxlen);
        }
        setSFD(false);
        if (DEBUG)         log("String_Node_Str" + rxFIFO.stateToString());
        if (((autoAck && ackRequest) || shouldAck) && crcOk) {
          setState(RadioState.TX_ACK_CALIBRATE);
        }
 else {
          setState(RadioState.RX_WAIT);
        }
      }
    }
  }
}