mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
ttf: Fixed an invalid unicode encoding.
Ensured the data count is correctly multiplied by the data size.
This commit is contained in:
parent
2726eb8baa
commit
31abe47a75
1 changed files with 2 additions and 2 deletions
|
@ -125,7 +125,7 @@ static uint32_t* _codepoints(const char* text, size_t n)
|
||||||
|
|
||||||
auto utf8 = text;
|
auto utf8 = text;
|
||||||
//preserve approximate enough space.
|
//preserve approximate enough space.
|
||||||
auto utf32 = (uint32_t*) malloc(sizeof(uint32_t) * n + 1);
|
auto utf32 = (uint32_t*) malloc(sizeof(uint32_t) * (n + 1));
|
||||||
|
|
||||||
while(*utf8) {
|
while(*utf8) {
|
||||||
if (!(*utf8 & 0x80U)) {
|
if (!(*utf8 & 0x80U)) {
|
||||||
|
@ -148,7 +148,7 @@ static uint32_t* _codepoints(const char* text, size_t n)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
utf32[i - 1] = 0; //end of the unicdoe
|
utf32[i] = 0; //end of the unicdoe
|
||||||
return utf32;
|
return utf32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue