POV-Ray : Newsgroups : povray.programming : Possible problem in Mac source Server Time
28 Jul 2024 22:32:01 EDT (-0400)
  Possible problem in Mac source (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Jon A  Cruz
Subject: Re: Possible problem in Mac source
Date: 14 Nov 1999 02:24:08
Message: <382E63E2.44D8BD9E@geocities.com>
Thorsten Froehlich wrote:

> In article <382DD8EA.259EDEF8@compuserve.com> , Chris Huff
> <Chr### [at] compuservecom>  wrote:
>
> > I have been trying to compile a Mac version of UVPov, but the compile
> > crashes immediately on startup. The crash does not occur when I compile
> > for the POV.PPC-dbg target, but does happen for the POV.PPC target. I
> > have not tested any others.
>
> The problem is the too long version string macro POV_RAY_VERSION which is
> copied into just 16 bytes of memory in function CreateSplashScreen in
> SplashScreen.c. Just change the size of povVers to 32.
>

NO NONO NONONONONONONNO!!!!!!!!
aaaaaaaaaaaaaahhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!!!

(sorry, but I sometimes panic at potentially dangerous code)  :-)

Wouldn't it be safer to change it to something like

[taking a wild guess without having the mac sources around]

char povVers[ sizeof(POV_RAY_VERSION) + 1 ];
or
char *povVers = (char *)malloc( sizeof(POV_RAY_VERSION) + 1 );

?

--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Possible problem in Mac source
Date: 14 Nov 1999 11:02:29
Message: <382edd15@news.povray.org>
In article <382E63E2.44D8BD9E@geocities.com> , "Jon A. Cruz" 
<jon### [at] geocitiescom> wrote:

> NO NONO NONONONONONONNO!!!!!!!!
> aaaaaaaaaaaaaahhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!!!
>
> (sorry, but I sometimes panic at potentially dangerous code)  :-)

Yes!!!!!!!

> Wouldn't it be safer to change it to something like
>
> [taking a wild guess without having the mac sources around]
>
> char povVers[ sizeof(POV_RAY_VERSION) + 1 ];
> or
> char *povVers = (char *)malloc( sizeof(POV_RAY_VERSION) + 1 );

Yes, that would have been better a long time ago, but keep two things in
mind:
First, that usually this string is a version number which shouldn't be that
long after all, i.e. "3.1g.r1" is only 10 bytes so 16 is safe for all
official cases.
Second, the Mac 3.1 code will be replaced completely with 3.5, so it makes
no sense to fix something that will never be used again, nor to invest even
a few seconds into it if those can be spend better on 3.5 :-)


      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

From: Thorsten Froehlich
Subject: Re: Possible problem in Mac source
Date: 14 Nov 1999 11:13:06
Message: <382edf92@news.povray.org>
In article <382edd15@news.povray.org> , "Thorsten Froehlich" 
<tho### [at] trfde> wrote:

> Second, the Mac 3.1 code will be replaced completely with 3.5, so it makes
> no sense to fix something that will never be used again, nor to invest even
> a few seconds into it if those can be spend better on 3.5 :-)

BTW, of course I made sure there won't be a problem in the Mac 3.5, and it
was already fixed in there :-)

pascal OSErr MacPOVRay_GetInfo(StringPtr versionstr, StringPtr
distributionstr)
{
 strncpy((char *)(versionstr + 1), POV_RAY_VERSION, 254);
 versionstr[0] = strlen((char *)(versionstr + 1));

 strncpy((char *)(distributionstr + 1), DISTRIBUTION_MESSAGE_1, 84);
 strncat((char *)(distributionstr + 1), DISTRIBUTION_MESSAGE_2, 84);
 strncat((char *)(distributionstr + 1), DISTRIBUTION_MESSAGE_3, 84);
 distributionstr[0] = strlen((char *)(distributionstr + 1));

 return noErr;
}

(Note that StringPtr points to pascal string buffers, each 256 bytes in
size).


    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

<<< Previous 10 Messages Goto Initial 10 Messages

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