mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
SWORD1: Avoid possible dereferencing of a null pointer
CID 1003605
This commit is contained in:
parent
621364edae
commit
ff1bdc7f58
@ -227,7 +227,8 @@ Header *ResMan::lockScript(uint32 scrID) {
|
||||
#else
|
||||
openScriptResourceLittleEndian(scrID);
|
||||
#endif
|
||||
return (Header *)resHandle(scrID)->data;
|
||||
MemHandle *handle = resHandle(scrID);
|
||||
return handle != NULL ? (Header *)handle->data : NULL;
|
||||
}
|
||||
|
||||
void ResMan::unlockScript(uint32 scrID) {
|
||||
@ -343,8 +344,8 @@ MemHandle *ResMan::resHandle(uint32 id) {
|
||||
uint8 cluster = (uint8)((id >> 24) - 1);
|
||||
uint8 group = (uint8)(id >> 16);
|
||||
|
||||
// There is a know case of reading beyond array boundaries when trying to use
|
||||
// portuguese subtitles (cluster file 2, group 6) with a version that do not
|
||||
// There is a known case of reading beyond array boundaries when trying to use
|
||||
// portuguese subtitles (cluster file 2, group 6) with a version that does not
|
||||
// contain subtitles for this languages (i.e. has only 6 languages and not 7).
|
||||
if (cluster >= _prj.noClu || group >= _prj.clu[cluster].noGrp)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user