samp-log-core icon indicating copy to clipboard operation
samp-log-core copied to clipboard

Incompatibility with PawnPlus, crashes from amx_GetCppString

Open AdamsLT opened this issue 4 years ago • 3 comments

In reference to an issue on PawnPlus, https://github.com/IllidanS4/PawnPlus/issues/38

Explanation from @IllidanS4:

str_format does not have anything to do with it; any PP string crashes when used in this code. The crash happens inside log-core, which is in turn invoked by the construction of CScopedDebugInfo in mysql_tquery. PawnPlus isn't invoked anywhere in the process. This is an issue in samp-log-core here. It for some reason uses its own copy of the AMX functions, bypassing PP's hooking mechanism, so dynamic strings could never work with it, unless it properly sticks to the AMX API. However, that could not cause the crash on its own, because amx_GetCppString is actually wrong and assumes that amx_GetAddr never fails, which it normally does when used on a PP string. This makes samp-log-core violate the first two points of the GCA for AMX API consumers and thus PawnPlus is not expected to work with it. I suggest you post an issue there so that it can be fixed.

AdamsLT avatar Aug 20 '20 11:08 AdamsLT

I should also mention that amx_GetCppString can be triggered to crash with any value outside the AMX range, which is something that could be caused by an incorrectly working Pawn script as well. However, comparing the error with AMX_ERR_NONE is still a good thing, since even though on one hand a function cannot be expected to work with an invalid value, on the other hand a logger is the last thing that should crash a system.

IS4Code avatar Aug 20 '20 11:08 IS4Code

@maddinat0r https://github.com/IllidanS4/PawnPlus/issues/46

ghost avatar Jun 05 '21 13:06 ghost

@maddinat0r , pls, fix(((

ererere2 avatar Sep 21 '21 11:09 ererere2