diff options
author | Bastien Montagne <bastien@blender.org> | 2020-09-20 19:41:50 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-09-20 19:41:50 +0300 |
commit | 5ea1049e7520c0f369d2a76811410b1274699e81 (patch) | |
tree | 5d7f5158b8c329b9a7e3b0fa5aa6ac2ce65701a1 /source/blender/blenkernel/intern | |
parent | 86c5d1f4aa07551b289619da501889a172a39e03 (diff) |
Sanitize type 'size' parameters in our read/write file code
This patch tries to sanitize the types of our size parameters across our read
and write code, which is currently fairly inconsistent (using `int`, `uint`,
`size_t`...), by using `size_t` everywhere. Since in Blender file themselves
we can only store chunk of size `MAX_INT`, added some asserts to ensure that
as well.
See {T79561} for details.
Differential Revision: https://developer.blender.org/D8672
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index a3e7d8c794d..af15b9143e7 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1186,7 +1186,7 @@ static void IDP_WriteArray(const IDProperty *prop, BlendWriter *writer) { /*REMEMBER to set totalen to len in the linking code!!*/ if (prop->data.pointer) { - BLO_write_raw(writer, (int)MEM_allocN_len(prop->data.pointer), prop->data.pointer); + BLO_write_raw(writer, MEM_allocN_len(prop->data.pointer), prop->data.pointer); if (prop->subtype == IDP_GROUP) { IDProperty **array = prop->data.pointer; @@ -1217,7 +1217,7 @@ static void IDP_WriteIDPArray(const IDProperty *prop, BlendWriter *writer) static void IDP_WriteString(const IDProperty *prop, BlendWriter *writer) { /*REMEMBER to set totalen to len in the linking code!!*/ - BLO_write_raw(writer, prop->len, prop->data.pointer); + BLO_write_raw(writer, (size_t)prop->len, prop->data.pointer); } static void IDP_WriteGroup(const IDProperty *prop, BlendWriter *writer) |