提交 699ee1f0 编写于 作者: Y youbing 提交者: youbing54

fixed 243e09d9 from https://gitee.com/youbing54/graphic_ui_3/pulls/803

fixed 9ebe972 from https://gitee.com/youbing54/graphic_ui_3/pulls/801
Description: Code alarm processing#7
IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I5XW8U
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: youbing54<youbing3@huawei.com>
上级 63489a40
......@@ -319,7 +319,11 @@ bool UIFontVector::GetTtfInfoFromTtf(uint8_t ttfId,
if (fpTtf < 0) {
return false;
}
ttfHeader.len = lseek(fpTtf, 0, SEEK_END);
int32_t headerLength = lseek(fpTtf, 0, SEEK_END);
if (headerLength < 0) {
return false;
}
ttfHeader.len = static_cast<uint32_t>(headerLength);
if (ttfHeader.len > ttfBufferSize) {
close(fpTtf);
return false;
......@@ -330,7 +334,7 @@ bool UIFontVector::GetTtfInfoFromTtf(uint8_t ttfId,
return false;
}
ret = read(fpTtf, reinterpret_cast<void*>(ttfBuffer), ttfHeader.len);
if (ret != ttfHeader.len) {
if (ret != headerLength) {
close(fpTtf);
return false;
}
......@@ -396,7 +400,10 @@ bool UIFontVector::GetTtfInfoFromTtc(uint8_t ttfId,
return false;
}
uint32_t ttfLength = 0;
FT_Long ttcLength = stream->size;
FT_ULong ttcLength = stream->size;
if (ttcLength < ttfOffset) {
return false;
}
if (ttfIndex + 1 == header.numFonts) {
ttfLength = ttcLength - ttfOffset;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册