| Summary: | RWops structure is allocated but uninitialized. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | sir_belial |
| Component: | file | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | gabomdq |
| Version: | HG 2.0 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
| Attachments: | Patch to fix above problems. | ||
Fixed, thanks! http://hg.libsdl.org/SDL/rev/fbb84f5b985f |
Created attachment 876 [details] Patch to fix above problems. In the SDL_RWFromFile function in SDL_rwops.c a RWops structure is allocated (line 450). This structure is then passed to Android_JNI_FileOpen (SDL_Android.cpp). This function calls various Java methods and jumps to the failure: mark if an exception is raised somewhere. When freeing the resources, members of the uninitialized RWops structure might be used, ie. if the ctx->hidden.androidio.readableByteChannelRef is not set because the file is not available (or any other java exception), the check against NULL might still return true. I resolved it by initializing the relevant members to NULL when entering the SDL_RWFromFile structure.