Skip to content

Commit a9b1b32

Browse files
committed
Handle negative input to base16Char
base16Char was being called with (c < 0), causing a failed assertion.
1 parent 6220a5c commit a9b1b32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flow/Trace.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct DynamicEventMetric;
137137

138138
template<class IntType>
139139
char base16Char(IntType c) {
140-
switch (c) {
140+
switch ((c % 16 + 16) % 16) {
141141
case 0:
142142
return '0';
143143
case 1:
@@ -325,8 +325,8 @@ struct TraceableStringImpl : std::true_type {
325325
} else {
326326
result.push_back('\\');
327327
result.push_back('x');
328-
result.push_back(base16Char((*iter / 16) % 16));
329-
result.push_back(base16Char(*iter % 16));
328+
result.push_back(base16Char(*iter / 16));
329+
result.push_back(base16Char(*iter));
330330
}
331331
}
332332
return result;

0 commit comments

Comments
 (0)