summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-01-04 21:02:17 +0100
committersfan5 <sfan5@live.de>2024-01-10 00:31:57 +0100
commit485221ba22674045d1af822b08fa193862dd835b (patch)
tree9588021aeb51b99e7c16c190391d9759222e81c5 /common
parent41259db9523bede8c656c7a8664484e0e4befa02 (diff)
downloadmpv-485221ba22674045d1af822b08fa193862dd835b.tar.bz2
mpv-485221ba22674045d1af822b08fa193862dd835b.tar.xz
msg: return zero length if bstr_split_utf8 fails
In theory bstr_split_utf8 should skip invalid sequence and move further, but it doesn't do that currently, so just the string if unsuported code if found. Fixes infinite loop on code.len == 0 condition. Fixes: 5864b72d1a0aecd7e2d56e546fb615d291c88274
Diffstat (limited to 'common')
-rw-r--r--common/msg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/msg.c b/common/msg.c
index 3373121c38..f435d6e206 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -350,7 +350,7 @@ static int term_disp_width(bstr str)
bstr code = bstr_split_utf8(str, &str);
if (code.len == 0)
- continue;
+ return 0;
if (code.len == 1 && *code.start == '\n')
continue;