未验证 提交 3bedcbb4 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #10682 from taosdata/fix/TS-1306

[TS-1306]<fix>: fix endless loop with utf-8 replacement character
...@@ -545,6 +545,9 @@ static void shellPrintNChar(const char *str, int length, int width) { ...@@ -545,6 +545,9 @@ static void shellPrintNChar(const char *str, int length, int width) {
if (bytes <= 0) { if (bytes <= 0) {
break; break;
} }
if (pos + bytes > length) {
break;
}
int w = 0; int w = 0;
#ifdef WINDOWS #ifdef WINDOWS
w = bytes; w = bytes;
...@@ -555,11 +558,11 @@ static void shellPrintNChar(const char *str, int length, int width) { ...@@ -555,11 +558,11 @@ static void shellPrintNChar(const char *str, int length, int width) {
w = wcwidth(wc); w = wcwidth(wc);
} }
#endif #endif
pos += bytes;
if (w <= 0) { if (w <= 0) {
continue; continue;
} }
pos += bytes;
if (pos > length) { if (pos > length) {
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册