diff --git a/src/IRrecv.cpp b/src/IRrecv.cpp index 4a6281b45..8eade6149 100644 --- a/src/IRrecv.cpp +++ b/src/IRrecv.cpp @@ -518,7 +518,9 @@ bool IRrecv::decode(decode_results *results, irparams_t *save, // interrupt. decode() is not stored in ICACHE_RAM. // Another better option would be to zero the entire irparams.rawbuf[] on // resume() but that is a much more expensive operation compare to this. - params.rawbuf[params.rawlen] = 0; + // However, don't do this if rawbuf is already full as we stomp over the heap. + // See: https://github.com/crankyoldgit/IRremoteESP8266/issues/1516 + if (!params.overflow) params.rawbuf[params.rawlen] = 0; bool resumed = false; // Flag indicating if we have resumed.