[wled][lcd_base][touchscreen][ee895] Fix off-by-one, buffer overrun, empty deref, and uninitialized pointers (#14513)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Jonathan Swoboda
2026-03-05 09:51:32 -10:00
committed by GitHub
co-authored by Copilot
parent 5c5ea8824e
commit bb37887a8c
4 changed files with 11 additions and 6 deletions
+3 -3
View File
@@ -22,9 +22,9 @@ class EE895Component : public PollingComponent, public i2c::I2CDevice {
void write_command_(uint16_t addr, uint16_t reg_cnt);
float read_float_();
uint16_t calc_crc16_(const uint8_t buf[], uint8_t len);
sensor::Sensor *co2_sensor_;
sensor::Sensor *temperature_sensor_;
sensor::Sensor *pressure_sensor_;
sensor::Sensor *co2_sensor_{nullptr};
sensor::Sensor *temperature_sensor_{nullptr};
sensor::Sensor *pressure_sensor_{nullptr};
enum ErrorCode { NONE = 0, COMMUNICATION_FAILED, CRC_CHECK_FAILED } error_code_{NONE};
};
+1 -1
View File
@@ -99,7 +99,7 @@ void HOT LCDDisplay::display() {
this->send(this->buffer_[this->columns_ * 2 + i], true);
}
if (this->rows_ >= 1) {
if (this->rows_ >= 2) {
this->command_(LCD_DISPLAY_COMMAND_SET_DDRAM_ADDR | 0x40);
for (uint8_t i = 0; i < this->columns_; i++)
+6 -1
View File
@@ -65,7 +65,12 @@ class Touchscreen : public PollingComponent {
void register_listener(TouchListener *listener) { this->touch_listeners_.push_back(listener); }
optional<TouchPoint> get_touch() { return this->touches_.begin()->second; }
optional<TouchPoint> get_touch() {
if (this->touches_.empty()) {
return {};
}
return this->touches_.begin()->second;
}
TouchPoints_t get_touches() {
TouchPoints_t touches;
@@ -161,7 +161,7 @@ bool WLEDLightEffect::parse_notifier_frame_(light::AddressableLight &it, const u
// https://kno.wled.ge/interfaces/udp-notifier/
// https://github.com/Aircoookie/WLED/blob/main/wled00/udp.cpp
if (size < 34) {
if (size <= 34) {
return false;
}