mirror of https://github.com/axmolengine/axmol.git
Processing Lua file(UTF8+BOM) that is encrypted will crash,when free the buffer pointer that is changed pointer address. (#17937)
This commit is contained in:
parent
3e912ffee3
commit
e6210874dd
|
@ -874,8 +874,10 @@ int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, cons
|
||||||
(unsigned char*)_xxteaKey,
|
(unsigned char*)_xxteaKey,
|
||||||
(xxtea_long)_xxteaKeyLen,
|
(xxtea_long)_xxteaKeyLen,
|
||||||
&len);
|
&len);
|
||||||
skipBOM((const char*&)result, (int&)len);
|
unsigned char* content = result;
|
||||||
r = luaL_loadbuffer(L, (char*)result, len, chunkName);
|
xxtea_long contentSize = len;
|
||||||
|
skipBOM((const char*&)content, (int&)contentSize);
|
||||||
|
r = luaL_loadbuffer(L, (char*)content, contentSize, chunkName);
|
||||||
free(result);
|
free(result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue