lewisxhe / AXP202X_Library

Arduino & ESP-IDF libraries written for AXP19x, 20x
MIT License
91 stars 40 forks source link

possible memory issue #41

Closed teaalltr closed 3 years ago

teaalltr commented 3 years ago

https://github.com/lewisxhe/AXP202X_Library/blob/c5219709b4c91145402b55d16a5571073980c5be/src/axp20x.cpp#L1807

Line 1650, val |= params[vol];

CPPCHECK says: Cppcheck: (warning) arrayIndexOutOfBoundsCond: Either the condition 'vol>sizeof(params)/sizeof(params[0])' is redundant or the array 'params[8]' is accessed at index 8, which is out of bounds.

lewisxhe commented 3 years ago

Before access, the array range has been restricted.

https://github.com/lewisxhe/AXP202X_Library/blob/c5219709b4c91145402b55d16a5571073980c5be/src/axp20x.cpp#L1802