diff options
author | 2014-05-09 20:38:46 +0000 | |
---|---|---|
committer | 2014-05-09 20:38:46 +0000 | |
commit | b6388089431ead442a5e9ef52e9bd89d7a30a0ae (patch) | |
tree | 6fe8b45d4dede5d27f3fcc424912d4888e80b5f3 /src/emu/digfx.c | |
parent | 5b6c5585b1ef4baabd20d1cd823daeb40d255ead (diff) |
fixed stack-buffer-overflow in device_gfx_interface::decode_gfx() with extended offsets [Alex Jackson]
Diffstat (limited to 'src/emu/digfx.c')
-rw-r--r-- | src/emu/digfx.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/emu/digfx.c b/src/emu/digfx.c index 432e41f7f37..0e3dc93a71f 100644 --- a/src/emu/digfx.c +++ b/src/emu/digfx.c @@ -192,14 +192,8 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // copy the X and Y offsets into our temporary arrays extxoffs.resize(glcopy.width * xscale); extyoffs.resize(glcopy.height * yscale); - memcpy(&extxoffs[0], glcopy.xoffset, glcopy.width * sizeof(UINT32)); - memcpy(&extyoffs[0], glcopy.yoffset, glcopy.height * sizeof(UINT32)); - - // if there are extended offsets, copy them over top - if (glcopy.extxoffs != NULL) - memcpy(&extxoffs[0], glcopy.extxoffs, glcopy.width * sizeof(UINT32)); - if (glcopy.extyoffs != NULL) - memcpy(&extyoffs[0], glcopy.extyoffs, glcopy.height * sizeof(UINT32)); + memcpy(&extxoffs[0], (glcopy.extxoffs != NULL) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(UINT32)); + memcpy(&extyoffs[0], (glcopy.extyoffs != NULL) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(UINT32)); // always use the extended offsets here glcopy.extxoffs = extxoffs; |