[remote_base][remote_receiver] Fix OOB access in pronto comparison and RMT buffer allocation (#14459)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jonathan Swoboda
2026-03-04 12:58:24 -05:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 5ba880f19b
commit 9abba79c54
2 changed files with 6 additions and 2 deletions
@@ -44,9 +44,13 @@ bool ProntoData::operator==(const ProntoData &rhs) const {
std::vector<uint16_t> data1 = encode_pronto(data);
std::vector<uint16_t> data2 = encode_pronto(rhs.data);
if (data1.size() != data2.size() || data1.empty()) {
return false;
}
uint32_t total_diff = 0;
// Don't need to check the last one, it's the large gap at the end.
for (std::vector<uint16_t>::size_type i = 0; i < data1.size() - 1; ++i) {
for (size_t i = 0; i < data1.size() - 1; ++i) {
int diff = data2[i] - data1[i];
diff *= diff;
if (rhs.delta == -1 && diff > 9)
@@ -106,7 +106,7 @@ void RemoteReceiverComponent::setup() {
this->store_.filter_symbols = this->filter_symbols_;
this->store_.receive_size = this->receive_symbols_ * sizeof(rmt_symbol_word_t);
this->store_.buffer_size = std::max((event_size + this->store_.receive_size) * 2, this->buffer_size_);
this->store_.buffer = new uint8_t[this->buffer_size_];
this->store_.buffer = new uint8_t[this->store_.buffer_size];
error = rmt_receive(this->channel_, (uint8_t *) this->store_.buffer + event_size, this->store_.receive_size,
&this->store_.config);
if (error != ESP_OK) {