Avoid a potential underflow when iterating over invalid inputs - #3096
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #3096 +/- ##
==========================================
- Coverage 91.36% 91.26% -0.10%
==========================================
Files 204 204
Lines 8903 8905 +2
==========================================
- Hits 8134 8127 -7
- Misses 769 778 +9 🚀 New features to boost your workflow:
|
|
Thanks, but the change should have tests. |
testcase added. |
|
ok, the testcase is failing some check, no idea what to do now. any hints? |
|
To quote from contributing.md.
Note that I am not sure tests with broken unicode will have portable serialization, in which case you need to add |
The forward iteration logic already bounds-check for m_it != m_string->end(), do the same for the backward iteration. The issue with the assert is that the assert() might not be compiled in, and it is happening after the dereference, so it was too late.
Patch release addressing two bug fixes in the test framework: - OOB read when scanning for the start of a broken UTF-8 sequence during linebreaking (catchorg/Catch2#3096) - ODR violation from TEMPLATE_LIST_TEST_CASE_METHOD and CATCH_TEMPLATE_PRODUCT_TEST_CASE (catchorg/Catch2#3161) Test-only dependency (FetchContent); not linked into shipped binaries. Verified: clean Release build, ctest 31/31 passing locally. Closes mousebrains#12 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The forward iteration logic already bounds-check for m_it != m_string->end(), do the same for the backward iteration. The issue with the assert is that the assert() might not be compiled in, and it is happening after the dereference, so it was too late.