mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Restated text format loop to avoid out-of-bounds condition
This commit is contained in:
parent
1efd8d3067
commit
f347611403
10
include/external/tbc_text_format.h
vendored
10
include/external/tbc_text_format.h
vendored
@ -84,8 +84,8 @@ namespace Tbc {
|
|||||||
|
|
||||||
if( itEnd != strEnd ) {
|
if( itEnd != strEnd ) {
|
||||||
bool foundWrapPoint = false;
|
bool foundWrapPoint = false;
|
||||||
for( iterator findIt = itEnd; !foundWrapPoint & findIt >= it; --findIt ) {
|
iterator findIt = itEnd;
|
||||||
|
do {
|
||||||
if( wrappableAfterChars.find( *findIt ) != std::string::npos && findIt != itEnd ) {
|
if( wrappableAfterChars.find( *findIt ) != std::string::npos && findIt != itEnd ) {
|
||||||
itEnd = findIt+1;
|
itEnd = findIt+1;
|
||||||
itNext = findIt+1;
|
itNext = findIt+1;
|
||||||
@ -101,7 +101,13 @@ namespace Tbc {
|
|||||||
itEnd = findIt;
|
itEnd = findIt;
|
||||||
foundWrapPoint = true;
|
foundWrapPoint = true;
|
||||||
}
|
}
|
||||||
|
if( findIt == it )
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
--findIt;
|
||||||
}
|
}
|
||||||
|
while( !foundWrapPoint );
|
||||||
|
|
||||||
if( !foundWrapPoint ) {
|
if( !foundWrapPoint ) {
|
||||||
// No good wrap char, so we'll break mid word and add a hyphen
|
// No good wrap char, so we'll break mid word and add a hyphen
|
||||||
--itEnd;
|
--itEnd;
|
||||||
|
Loading…
Reference in New Issue
Block a user