Skip to content

Commit 4e56410

Browse files
committed
Fix infinite loop in logger.
When there where was more arguments then "{}" in the format string program hanged up due to infinite loop in format function. Signed-off-by: Łukasz Plewa <[email protected]>
1 parent e439801 commit 4e56410

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/common/logger/ur_sinks.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ class Sink {
110110
<< std::endl;
111111
}
112112
}
113+
114+
if (*fmt == '\0') {
115+
std::cerr << error_prefix << "Too many arguments!" << std::endl;
116+
// ignore all left arguments and finalize message
117+
format(buffer, fmt);
118+
return;
119+
}
113120
}
114121

115122
format(buffer, ++fmt, std::forward<Args &&>(args)...);

0 commit comments

Comments
 (0)