I meet a problem with max7219 driver when I was using it with 7-segment display:
max7219_draw_text_7seg() function is not detecting zero bytes in null-terminated input string, which causes drawing wrong (not expected) symbols after good ones.
I checked the code of max7219_draw_text_7seg() function, and I think that there is a bug at 239 line of the driver: while (s && pos < dev->digits)
As I can understand from the code, the idea was to check that current symbol of the string is not null, null symbol stops drawing.
But "s" is a pointer (address in memory), so it is not null and it should not became null.
Changing this line to "while (*s && (pos < dev->digits))" is making this code sensitive to null-terminated strings and resolve the problem.
Which SDK are you using?
esp-idf
Which version of SDK are you using?
v4.4.2
Which build target have you used?
[X] esp32
[ ] esp32s2
[ ] esp32s3
[ ] esp32c2
[ ] esp8266
[ ] other
Component causing the issue
MAX7219
Anything in the logs that might be useful for us?
No response
Additional information or context
No response
Confirmation
[X] This report is not a question nor a request for drivers.
The issue
I meet a problem with max7219 driver when I was using it with 7-segment display: max7219_draw_text_7seg() function is not detecting zero bytes in null-terminated input string, which causes drawing wrong (not expected) symbols after good ones.
I checked the code of max7219_draw_text_7seg() function, and I think that there is a bug at 239 line of the driver:
while (s && pos < dev->digits) As I can understand from the code, the idea was to check that current symbol of the string is not null, null symbol stops drawing. But "s" is a pointer (address in memory), so it is not null and it should not became null. Changing this line to "while (*s && (pos < dev->digits))" is making this code sensitive to null-terminated strings and resolve the problem.
Which SDK are you using?
esp-idf
Which version of SDK are you using?
v4.4.2
Which build target have you used?
Component causing the issue
MAX7219
Anything in the logs that might be useful for us?
No response
Additional information or context
No response
Confirmation