diff options
author | lazydodo <github@lazydodo.com> | 2017-05-26 15:26:21 +0300 |
---|---|---|
committer | lazydodo <github@lazydodo.com> | 2017-05-26 15:26:21 +0300 |
commit | bddd9d809d2c291eb0a92220195908c51ae2ce80 (patch) | |
tree | b59ef35090ddfe1b42086be5beb2f9f4c3ea40e5 /source | |
parent | bf5e717ef5617c597710c2836b511f9f089fcfc2 (diff) |
Fix integer overflows in meshcache modifier.
Differential Revision: https://developer.blender.org/D2688
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshcache_mdd.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_meshcache_pc2.c | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_meshcache_mdd.c b/source/blender/modifiers/intern/MOD_meshcache_mdd.c index 90fc750de3b..3dd3a5fc598 100644 --- a/source/blender/modifiers/intern/MOD_meshcache_mdd.c +++ b/source/blender/modifiers/intern/MOD_meshcache_mdd.c @@ -35,6 +35,9 @@ #ifdef __LITTLE_ENDIAN__ # include "BLI_endian_switch.h" #endif +#ifdef WIN32 +# include "BLI_winstuff.h" +#endif #include "MOD_meshcache_util.h" /* own include */ @@ -157,7 +160,7 @@ bool MOD_meshcache_read_mdd_index(FILE *fp, return false; } - if (fseek(fp, index * mdd_head.verts_tot * sizeof(float) * 3, SEEK_CUR) != 0) { + if (fseek(fp, sizeof(float) * 3 * index * mdd_head.verts_tot, SEEK_CUR) != 0) { *err_str = "Failed to seek frame"; return false; } diff --git a/source/blender/modifiers/intern/MOD_meshcache_pc2.c b/source/blender/modifiers/intern/MOD_meshcache_pc2.c index 219eae4ecca..8360c8ffda7 100644 --- a/source/blender/modifiers/intern/MOD_meshcache_pc2.c +++ b/source/blender/modifiers/intern/MOD_meshcache_pc2.c @@ -35,6 +35,10 @@ # include "BLI_endian_switch.h" #endif +#ifdef WIN32 +# include "BLI_winstuff.h" +#endif + #include "MOD_meshcache_util.h" /* own include */ #include "DNA_modifier_types.h" @@ -142,7 +146,7 @@ bool MOD_meshcache_read_pc2_index(FILE *fp, return false; } - if (fseek(fp, index * pc2_head.verts_tot * sizeof(float) * 3, SEEK_CUR) != 0) { + if (fseek(fp, sizeof(float) * 3 * index * pc2_head.verts_tot , SEEK_CUR) != 0) { *err_str = "Failed to seek frame"; return false; } |