Revert "FileSystem: Allow ::openReadRaw() to break out of game directory"

This reverts commit d45a400227.
Causes memory corruption in its current state.
This commit is contained in:
Ancurio 2021-09-27 18:23:16 +02:00
parent ddde452544
commit 3d6b7d3b75
5 changed files with 39 additions and 32 deletions

View file

@ -33,6 +33,7 @@ fileIntFreeInstance(void *inst)
{
SDL_RWops *ops = static_cast<SDL_RWops*>(inst);
SDL_RWclose(ops);
SDL_FreeRW(ops);
}
@ -41,14 +42,16 @@ DEF_TYPE_CUSTOMFREE(FileInt, fileIntFreeInstance);
static VALUE
fileIntForPath(const char *path, bool rubyExc)
{
SDL_RWops *ops;
SDL_RWops *ops = SDL_AllocRW();
try
{
ops = shState->fileSystem().openReadRaw(path);
shState->fileSystem().openReadRaw(*ops, path);
}
catch (const Exception &e)
{
SDL_FreeRW(ops);
if (rubyExc)
raiseRbExc(e);
else