Raised This Month: $71 Target: $400
 17% 

set/get_pcvar_* error/crash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
E1_531G
Senior Member
Join Date: Dec 2017
Old 09-17-2018 , 17:56   set/get_pcvar_* error/crash
Reply With Quote #1

Hello.

I just found an error.

Code
PHP Code:
new pointer 432
if( get_pcvar_num(pointer) )
  ... 
will result in an instant crash of the server.

Windows, 1.8.2 latest. (it seems that there is no difference with 1.8.3 and 1.9)

I know that there is no way to see this situation in a real use (because of get_cvar_pointer() and register_cvar()/create_cvar()), but it will be better if the server does not crash and simply throws an error.

Thank.
__________________
My English is A0
E1_531G is offline
KliPPy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-17-2018 , 20:09   Re: set/get_pcvar_* error/crash
Reply With Quote #2

Pcvars are really just cvar pointers - it's impossible to check whether it's really pointing to a cvar_t struct, unless we change the implementation (i.e. use handles). Not sure if this would be a breaking change, doesn't seem so.

Anyway, just don't do that, I think it's rather obvious that you shouldn't do that.
__________________
KliPPy is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 09-18-2018 , 03:09   Re: set/get_pcvar_* error/crash
Reply With Quote #3

Quote:
Originally Posted by E1_531G View Post
Hello.

I just found an error.

Code
PHP Code:
new pointer 432
if( get_pcvar_num(pointer) )
  ... 
will result in an instant crash of the server.

Windows, 1.8.2 latest. (it seems that there is no difference with 1.8.3 and 1.9)

I know that there is no way to see this situation in a real use (because of get_cvar_pointer() and register_cvar()/create_cvar()), but it will be better if the server does not crash and simply throws an error.

Thank.
get_tr2(1, TR_pHit)

As wrote above, they are just pointers, a memory address.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:04.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode