diff options
author | tron <tron@openttd.org> | 2004-11-17 17:15:36 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2004-11-17 17:15:36 +0000 |
commit | c4e989685179fbe463d138834f71375e94e0fbad (patch) | |
tree | 83c8ab527dfe114dbc91749eca02b76408c4eb35 | |
parent | 155f20329b200a37455f94c9000fd146f41ee0d4 (diff) | |
download | openttd-c4e989685179fbe463d138834f71375e94e0fbad.tar.xz |
(svn r658) Ignore callbackish randomized spritegroups - they would just crash us (pasky)
-rw-r--r-- | grfspecial.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/grfspecial.c b/grfspecial.c index 4809af5d1..7141a6781 100644 --- a/grfspecial.c +++ b/grfspecial.c @@ -1212,6 +1212,13 @@ static void NewSpriteGroup(byte *buf, int len) rg->groups = calloc(rg->num_groups, sizeof(*rg->groups)); for (i = 0; i < rg->num_groups; i++) { uint16 groupid = grf_load_word(&buf); + + if (groupid & 0x8000 || groupid >= _cur_grffile->spritegroups_count) { + /* This doesn't exist for us. */ + i--; + rg->num_groups--; + continue; + } /* XXX: If multiple surreal sets attach a surreal * set this way, we are in trouble. */ rg->groups[i] = _cur_grffile->spritegroups[groupid]; |