!2950 image svg格式校验条件修改

Merge pull request !2950 from fandongyu/master
This commit is contained in:
openharmony_ci 2024-11-21 12:58:26 +00:00 committed by Gitee
commit 5baab83647
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -33,7 +33,9 @@ using namespace MultimediaPlugin;
namespace {
static const std::string FORMAT_TYPE = "image/svg+xml";
static const char SVG_STAMP[] = "<?xml";
static const char SVG_SIGN[] = "<svg ";
static constexpr uint8_t SVG_STAMP_LEN = 5;
static constexpr uint8_t SVG_SIGN_LEN = 5;
}
std::string SvgFormatAgent::GetFormatType()
@ -58,7 +60,7 @@ bool SvgFormatAgent::CheckFormat(const void *headerData, uint32_t dataSize)
return false;
}
if (memcmp(SVG_STAMP, headerData, SVG_STAMP_LEN) != 0) {
if (memcmp(SVG_STAMP, headerData, SVG_STAMP_LEN) != 0 && memcmp(SVG_SIGN, headerData, SVG_SIGN_LEN) != 0) {
IMAGE_LOGD("header stamp mismatch.");
return false;
}