forked from bartvdbraak/blender
fix for crash reading pointcache, was reading over the buffer size, use lzo1x_decompress_safe rather then lzo1x_decompress
This commit is contained in:
parent
c3dbd2a46b
commit
3409eb429e
@ -812,12 +812,15 @@ static int ptcache_compress_read(PTCacheFile *pf, unsigned char *result, unsigne
|
||||
ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char));
|
||||
if(compressed) {
|
||||
ptcache_file_read(pf, &in_len, 1, sizeof(unsigned int));
|
||||
if(in_len==0) {
|
||||
/* do nothing */
|
||||
}
|
||||
else {
|
||||
in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer");
|
||||
ptcache_file_read(pf, in, in_len, sizeof(unsigned char));
|
||||
|
||||
#ifdef WITH_LZO
|
||||
if(compressed == 1)
|
||||
r = lzo1x_decompress(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
|
||||
r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
|
||||
#endif
|
||||
#ifdef WITH_LZMA
|
||||
if(compressed == 2)
|
||||
@ -830,6 +833,7 @@ static int ptcache_compress_read(PTCacheFile *pf, unsigned char *result, unsigne
|
||||
#endif
|
||||
MEM_freeN(in);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ptcache_file_read(pf, result, len, sizeof(unsigned char));
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ static void rna_def_pointcache(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
|
||||
RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked indo another file.");
|
||||
RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked into another file.");
|
||||
RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
|
||||
|
||||
prop= RNA_def_property(srna, "point_cache_list", PROP_COLLECTION, PROP_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user