Any Debug::Print line longer than 45 characters writes past its buffer
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- embedded-iot
Research direction
Start with the Debug::Print function and its 45-byte static buffer, where the snprintfEx call formats the text. The issue proposes clamping the terminating zero index to the buffer size; check that expression against the return value of snprintfEx before changing anything. Done means a line longer than 45 characters no longer writes past the buffer, and a short line still prints unchanged.
Written by the indexing model from the issue text.
Description
- What this is: Debug::Print formats text into a 45-byte static buffer with snprintfEx.
- Problem: snprintfEx keeps counting characters past the buffer size, then writes the closing '\0' at that count. Debug::Print(1,1,"%s", someLongString) with a 100-character result writes a zero byte 55 bytes past the buffer, into other static data.
- Fix: One line: buffer[writtenChars < size ? writtenChars : size - 1] = '\0';
- Dominant language
- C++
- Stars
- 90
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ReyeMe/SaturnRingLib
-
bug required hardware test
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ReyeMe/SaturnRingLib#148 ·
-
bug required hardware test
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ReyeMe/SaturnRingLib#147 ·
-
bug required hardware test
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ReyeMe/SaturnRingLib#146 ·
-
bug required hardware test
Difficulty 1/5 Under an hour Newbie friendliness 82/100
ReyeMe/SaturnRingLib#145 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
ReyeMe/SaturnRingLib#149 ·
All issues in ReyeMe/SaturnRingLib
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google/tensorstore#306 ·
-
comp-formats
Difficulty 2/5 Half a day Newbie friendliness 64/100
ClickHouse/ClickHouse#131694 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ETSInitiative/PETSIRD#243 ·
Maintainers usually reply within 1 day
-
[BUG][Ascend][AscendC] Scalar FP8 arithmetic stored to UB emits ".data" on a float and fails deviceOpenascend bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day