POV-Ray : Newsgroups : povray.beta-test : crash with string writing Server Time
29 Jul 2024 22:22:26 EDT (-0400)
  crash with string writing (Message 1 to 3 of 3)  
From:
Subject: crash with string writing
Date: 27 Feb 2002 06:17:33
Message: <06fp7ucrh0144h951dfoleg82i6nmp7f57@4ax.com>
POV 3.5 b 11 icl on WinNT Sp 6 PII 233 with 128 MB

My following script causes crash at moment of writing script into file (I know
it becouse empty file appear on drive). Any confirmation ?

#include "functions.inc"
#include "math.inc"

#macro Function_To_DF3(Func,FileName,BMin,BMax,Res)
  // corrections of parameters
  #local BMin=BMin+x*0;
  #local BMax=BMax+x*0;
  #local Res=Res+x*0;
  #local Res=<max(1,int(Res.x)),max(1,int(Res.y)),max(1,int(Res.z))>;
  // help variables
  #local Min=<min(BMin.x,BMax.x),min(BMin.y,BMax.y),min(BMin.z,BMax.z)>;
  #local Max=<max(BMin.x,BMax.x),max(BMin.y,BMax.y),max(BMin.z,BMax.z)>;
  #local Size=Max-Min;
  #local Step=Size/(Res-1);
  // temporary function for faster calculations
  #local Mx=Min.x;
  #local My=Min.y;
  #local Mz=Min.z;
  #local Sx=Step.x;
  #local Sy=Step.y;
  #local Sz=Step.z;
  #local f=function{clip(int(255.999*Func(Mx+x*Sx,My+y*Sy,Mz+z*Sz)),0,255)}
  // string creation
  #local S=""; // to do : header creation
  #local X=0;
  #while (X<Res.x)
    #local Y=0;
    #while (Y<Res.y)
      #local Z=0;
      #while (Z<Res.z)
        #local S=concat(S,chr(f(X,Y,Z)));
        #local Z=Z+1;
      #end
      #local Y=Y+1;
    #end
    #local X=X+1;
  #end
  // file creation
  #fopen DF3 FileName write
  #write(DF3,S)
  #fclose DF3
#end

Function_To_DF3(function{pattern{agate}},"temp.df3",-1,1,<10,11,12>)

ABX


Post a reply to this message

From: Gleb
Subject: Re: crash with string writing
Date: 27 Feb 2002 15:19:00
Message: <3c7d3f34$1@news.povray.org>
"W?odzimierz ABX Skiba" <abx### [at] babilonorg> wrote in message
news:06fp7ucrh0144h951dfoleg82i6nmp7f57@4ax.com...
> POV 3.5 b 11 icl on WinNT Sp 6 PII 233 with 128 MB
>
> My following script causes crash at moment of writing script into file (I
know
> it becouse empty file appear on drive). Any confirmation ?

Confirm                  (POV 3.5 b 11  PIII-1000 512 Mb Win2000 )


I've found it crashing when strlen(S) is>1042

#write(DF3,substr(S,1,1042))                       // works fine;

////// but (strange) this sequence:
  #declare S=concat(substr(S,1,1042)," ");
  #write(DF3,substr(S,1,1042))                    //crashes

Atb,

Gleb


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: crash with string writing
Date: 27 Feb 2002 16:09:42
Message: <3c7d4b16@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

>        #local S=concat(S,chr(f(X,Y,Z)));

The string you produce is too long and causes a buffer overflow.  While it
will work in the next beta, it will only work at a significant performance
penalty (by internally writing long strings character by character).

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.