Re: [ioquake3] [quake3-commits] r2280 - in trunk/code: cgame game q3_ui ui

2012-06-20 Thread Ludwig Nussel
donotre...@icculus.org wrote:
> Author: ztm
> Date: 2012-06-19 10:52:22 -0400 (Tue, 19 Jun 2012)
> New Revision: 2280
> 
> Modified:
>trunk/code/cgame/cg_main.c
>trunk/code/game/g_cmds.c
>trunk/code/game/g_main.c
>trunk/code/q3_ui/ui_atoms.c
>trunk/code/ui/ui_atoms.c
>trunk/code/ui/ui_main.c
> Log:
> remove a bunch of superfluous formatting calls
> 
>>From /dev/humancontroller.
> 
> Modified: trunk/code/cgame/cg_main.c
> ===
> --- trunk/code/cgame/cg_main.c2012-06-19 14:51:02 UTC (rev 2279)
> +++ trunk/code/cgame/cg_main.c2012-06-19 14:52:22 UTC (rev 2280)
> @@ -446,7 +446,7 @@
>   Q_vsnprintf (text, sizeof(text), error, argptr);
>   va_end (argptr);
>  
> - CG_Error( "%s", text);
> + trap_Error( text );

Don't do that. That's calling for format string issues ie security bugs.
May not be an issue with ioq3 builtin function (I didn't check) but in
general keeping the "%s" is correct. Please revert the change.

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 
16746 (AG Nürnberg) 
___
ioquake3 mailing list
ioquake3@lists.ioquake.org
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.


Re: [ioquake3] [quake3-commits] r2280 - in trunk/code: cgame game q3_ui ui

2012-06-20 Thread Thilo Schulz
On Wednesday, 20. June 2012 09:06:36 Ludwig Nussel wrote:
> Don't do that. That's calling for format string issues ie security bugs.
> May not be an issue with ioq3 builtin function (I didn't check) but in
> general keeping the "%s" is correct. Please revert the change.

I have to agree with Ludwig. This is bad practice.

-- 
Thilo Schulz


signature.asc
Description: This is a digitally signed message part.
___
ioquake3 mailing list
ioquake3@lists.ioquake.org
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.

Re: [ioquake3] [quake3-commits] r2280 - in trunk/code: cgame game q3_ui ui

2012-06-20 Thread Ludwig Nussel
Ludwig Nussel wrote:
> donotre...@icculus.org wrote:
>> Author: ztm
>> Date: 2012-06-19 10:52:22 -0400 (Tue, 19 Jun 2012)
>> New Revision: 2280
>>
>> Modified:
>>trunk/code/cgame/cg_main.c
>>trunk/code/game/g_cmds.c
>>trunk/code/game/g_main.c
>>trunk/code/q3_ui/ui_atoms.c
>>trunk/code/ui/ui_atoms.c
>>trunk/code/ui/ui_main.c
>> Log:
>> remove a bunch of superfluous formatting calls
>>
>> >From /dev/humancontroller.
>>
>> Modified: trunk/code/cgame/cg_main.c
>> ===
>> --- trunk/code/cgame/cg_main.c   2012-06-19 14:51:02 UTC (rev 2279)
>> +++ trunk/code/cgame/cg_main.c   2012-06-19 14:52:22 UTC (rev 2280)
>> @@ -446,7 +446,7 @@
>>  Q_vsnprintf (text, sizeof(text), error, argptr);
>>  va_end (argptr);
>>  
>> -CG_Error( "%s", text);
>> +trap_Error( text );
> 
> Don't do that. That's calling for format string issues ie security bugs.
> May not be an issue with ioq3 builtin function (I didn't check) but in
> general keeping the "%s" is correct. Please revert the change.

Ah, trap_Error isn't actually varargs. It expects the expanded string
already and translates to Com_Error( ERR_DROP, "%s", ... later. So it's
actually ok.

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 
16746 (AG Nürnberg) 
___
ioquake3 mailing list
ioquake3@lists.ioquake.org
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.


Re: [ioquake3] r2280 - in trunk/code: cgame game q3_ui ui

2012-06-20 Thread Tim Angus
On Wed, 20 Jun 2012, 08:43:08 BST, Ludwig Nussel  wrote:
> > > -    CG_Error( "%s", text);
> > > +    trap_Error( text );
> > 
> > Don't do that. That's calling for format string issues ie security
> > bugs. May not be an issue with ioq3 builtin function (I didn't check)
> > but in general keeping the "%s" is correct. Please revert the change.
> 
> Ah, trap_Error isn't actually varargs. It expects the expanded string
> already and translates to Com_Error( ERR_DROP, "%s", ... later. So it's
> actually ok.

It does seem like change for change's sake though. There is no real benefit to 
this patch besides a vanishingly minor performance improvement, coupled with 
the risk of introducing bugs. I'm not saying revert it, but I do question the 
logic of applying it in the first place.
___
ioquake3 mailing list
ioquake3@lists.ioquake.org
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.

Re: [ioquake3] Programming question

2012-06-20 Thread Yasir I . Al-Dosary - zgzg2020™
I think I'm finally getting this thing working!

I just wanted to say thank you all for your help!




>
> From: Harley Laue 
>To: ""Yasir I. Al-Dosary - zgzg2020™""  
>Cc: Primary ioquake3 Discussion/Development list  
>Sent: Tuesday, June 19, 2012 10:37 PM
>Subject: Re: [ioquake3] Programming question
> 
>On 06/19/2012 02:30 AM, Yasir I. Al-Dosary - zgzg2020™ wrote:
>> Thank you for kindly answering my questions!
>>
>> >If you need them and don't care about compatibility with ioquake why not
>> >modify the exported functions to game?
>> I'm exactly just that right now. I've given up on using time.h.
>> So, I found trap_AAS_Time(). And, I'm moving to it.
>> However, I also need to write to files. I tried to add stdio.h. But, I 
>> got the same problem as when I add time.h
>> Does ioquake3 offer File I/O capabilities as well?
>>
>Pretty sure what you want is in game/g_local.h
>int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
>void trap_FS_Read( void *buffer, int len, fileHandle_t f );
>void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
>void trap_FS_FCloseFile( fileHandle_t f );
>int trap_FS_GetFileList( const char *path, const char *extension, char 
>*listbuf, int bufsize );
>int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
>
>> Best regards!
>>
>>     
>>     *From:* Harley Laue 
>>     *To:* Yasir I. Al-Dosary - zgzg2020™ ;
>>     Primary ioquake3 Discussion/Development list
>>     
>>     *Sent:* Tuesday, June 19, 2012 3:46 PM
>>     *Subject:* Re: [ioquake3] Programming question
>>
>>     On Monday, June 18, 2012 10:45:16 PM Yasir I. Al-Dosary -
>>     zgzg2020™ wrote:
>>     > Thanks for the reply again!
>>     > When I compile with "BUILD_GAME_SO=1 and BUILD_GAME_QVM=0" qvms
>>     don't get
>>     > built, which I'm guessing is the point of the second option. The
>>     > compilation completes without any errors.
>>     >
>>     > However when I run the Game:
>>     > ./ioq3ded.ppc64 +set fs_game Mod +set sv_pure 0 +set vm_game 0
>>     +set vm_cgame
>>     > 0 +set vm_ui 0 +set dedicated 1 +exec something_112_respwn.cfg
>>     >
>>     > The Game crashes right away. I placed the log at the end of this
>>     email.
>>     >
>>     > I have several questions that I would really like some help with.
>>     > Regarding LCC compiler you kindly mentioned before:
>>     > * I couldn't find a version of it on linux. How is it being used
>>     on linux
>>     > when it is a Windows-only compiler? * If LCC compiler is
>>     available on
>>     > Linux, where can I download it? Because I am thinking maybe the LCC
>>     > compiler settings might have a problem.
>>
>>     See code/tools/lcc
>>
>>     >
>>     > Regarding the compilation of QVM files:
>>     > * I have noticed from the compilation log that they are compiled
>>     as C++
>>     > files, and C files: cpp: code/game/ai_main.c:2712 Could not find
>>     include
>>     > file  make[2]: ***
>>     > [build/release-linux-ppc64/baseq3/game/ai_main.asm] Error 1 Why
>>     is that?
>>
>>     CPP == C Pre-Processor in this case if I'm not mistaken.
>>
>>     > In qcommon/q_shared.h, I've also written in below:
>>     > * What does this quote mean?
>>     > * time.h is included inside q_shared.h, and q_shared.h is
>>     included inside
>>     > ai_main.c. Therefore, shouldn't this allow me to use the time
>>     library?
>>     >
>>     > ioquake3 general questions:
>>     > The main reason I need to solve this current problem is the
>>     following. I
>>     > need a high precision time measuring tool, such as time.h. I am sure
>>     > ioquake3 requires such tools as well, to regulate frames...etc.
>>     * Is there
>>     > a time tool I can use inside ioquake3 without the need to add
>>     something new
>>     > from the outside such as time.h?
>>
>>     If you need them and don't care about compatibility with ioquake
>>     why not
>>     modify the exported functions to game?
>>
>>
>>     As for below:
>>     > Sys_LoadDll(./Mod/qagameppc.so) failed:
>>     > "./Mod/qagameppc.so: undefined symbol: Com_Quit_f"
>>     Would be where I would start investigating.
>>
>>     > I really appreciate this! I really need to be able to use the
>>     time library
>>     > inside ai_main.c very badly.
>>     >
>>     > --Q_SHARED.H
>>     >
>>     /**
>>     >  VM Considerations
>>     >  The VM can not use the standard system headers because we
>>     aren't really
>>     >  using the compiler they were meant for.  We use bg_lib.h which
>>     contains
>>     >  prototypes for the functions we define for our own use in bg_lib.c.
>>     >  When writing mods, please add needed headers HERE, do not start
>>     including
>>     >  stuff like  in the various .c files that make up each
>>     of the VMs
>>