[Bf-committers] 64-bit bug loading .blend files containing scriptlinks

Ton Roosendaal ton at blender.org
Sat Nov 19 18:51:12 CET 2005


Hi,

> static void write_scriptlink(WriteData *wd, ScriptLink *slink)
> {
>     writedata(wd, DATA, sizeof(void *)*slink->totscript,  
> slink->scripts);
>     writedata(wd, DATA, sizeof(short)*slink->totscript, slink->flag);
> }
>
> the slink->script is written based on the structure, which is an array  
> of pointers.  It reads this in again on load, but again assumes it's
> an array of 64-bit pointers when it's used.

Ahh.. it is written as a pointer array, that needs separate handling in  
reading files.
I've committed the fix, thanks!

-Ton-

BTW; if you've got time, check all pointer arrays written, and if they  
get read OK (see diff of last commit) :)


>
> I tested on two linux intel systems.
>
> Ken
>
>> On 18 Nov, 2005, at 23:48, Ken Hughes wrote:
>>> This is the first real 64-bit bug I've seen (which is good).  A  
>>> .blend  file from a 32-bit system which contains three scriptlinks  
>>> is loaded  on my AMD64 system under linux.  As read_struct() load  
>>> the file, it  gets to the structure for the scriptlinks and  
>>> allocates memory for 3  pointers for a total of 12 bytes.  Later,  
>>> when lib_link_scriptlink()  is called, it goes through trying to  
>>> relink the objects, but thinks  slink->scripts is pointer at 8-byte  
>>> pointers.  The result is memory  errors on exit (either from  
>>> MEM_freen() or glibc).  For now I've  verified using a hack in  
>>> lib_link_scriptlink() that correctly  converting the 32-bit pointers  
>>> to 64-bit pointers and reallocating the  proper storage fixes the  
>>> problem.
>>>
>>> Any suggestions what to do?  I'm not familiar with this part of the   
>>> source tree at all.
>>>
>>> Ken
>>> _______________________________________________
>>> Bf-committers mailing list
>>> Bf-committers at projects.blender.org
>>> http://projects.blender.org/mailman/listinfo/bf-committers
>>>
>>>
>> ---------------------------------------------------------------------- 
>> -- --
>> Ton Roosendaal  Blender Foundation ton at blender.org   
>> http://www.blender.org
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at projects.blender.org
>> http://projects.blender.org/mailman/listinfo/bf-committers
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list