AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   set/get_pcvar_* error/crash (https://forums.alliedmods.net/showthread.php?t=310739)

E1_531G 09-17-2018 16:56

set/get_pcvar_* error/crash
 
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.

klippy 09-17-2018 19:09

Re: set/get_pcvar_* error/crash
 
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.

meTaLiCroSS 09-18-2018 02:09

Re: set/get_pcvar_* error/crash
 
Quote:

Originally Posted by E1_531G (Post 2615604)
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.


All times are GMT -4. The time now is 21:35.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.