mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
svg_loader SvgUtil: Move nullcheck to before use
prevent invalid access
This commit is contained in:
parent
333cac8d9d
commit
bbc0fbb130
1 changed files with 6 additions and 2 deletions
|
@ -261,8 +261,10 @@ on_error:
|
||||||
|
|
||||||
string svgUtilURLDecode(const char *src)
|
string svgUtilURLDecode(const char *src)
|
||||||
{
|
{
|
||||||
|
if (!src) return nullptr;
|
||||||
|
|
||||||
auto length = strlen(src);
|
auto length = strlen(src);
|
||||||
if (!src || length == 0) return nullptr;
|
if (length == 0) return nullptr;
|
||||||
|
|
||||||
string decoded;
|
string decoded;
|
||||||
decoded.reserve(length);
|
decoded.reserve(length);
|
||||||
|
@ -291,8 +293,10 @@ string svgUtilURLDecode(const char *src)
|
||||||
|
|
||||||
string svgUtilBase64Decode(const char *src)
|
string svgUtilBase64Decode(const char *src)
|
||||||
{
|
{
|
||||||
|
if (!src) return nullptr;
|
||||||
|
|
||||||
auto length = strlen(src);
|
auto length = strlen(src);
|
||||||
if (!src || length == 0) return nullptr;
|
if (length == 0) return nullptr;
|
||||||
|
|
||||||
string decoded;
|
string decoded;
|
||||||
decoded.reserve(3*(1+(length >> 2)));
|
decoded.reserve(3*(1+(length >> 2)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue