mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 11:10:06 -05:00
Merge topic 'utf8-decode-empty'
0bd6009a0c cm_utf8: Fail on empty input range
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6885
This commit is contained in:
@@ -42,6 +42,11 @@ static unsigned int const cm_utf8_min[7] = {
|
||||
const char* cm_utf8_decode_character(const char* first, const char* last,
|
||||
unsigned int* pc)
|
||||
{
|
||||
/* We need at least one byte. */
|
||||
if (first == last) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Count leading ones in the first byte. */
|
||||
unsigned char c = (unsigned char)*first++;
|
||||
unsigned char const ones = cm_utf8_ones[c];
|
||||
|
||||
Reference in New Issue
Block a user