Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening file with invalid open mode crashes server #2069

Open
6 tasks done
Vinillia opened this issue Oct 21, 2023 · 0 comments
Open
6 tasks done

Opening file with invalid open mode crashes server #2069

Vinillia opened this issue Oct 21, 2023 · 0 comments

Comments

@Vinillia
Copy link

Help us help you

  • I have checked that my issue doesn't exist yet.
  • I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • I can always reproduce the issue with the provided description below.

Environment

  • Operating System version: Windows 10 v22H2 (OS Build 19045.3570)
  • Game/AppID (with version if applicable): 550
  • Current SourceMod version: 1.11.0.6943
  • Current Metamod: Source snapshot: 1.12.0-dev+1189

Description

Opening file with invalid open mode raises unhandled exception.

Problematic Code (or Steps to Reproduce)

#include <sourcemod>

public void OnPluginStart()
{
  File file = OpenFile("eggcelent.txt", "rw");
}

Logs

Stack Trace
sourcemod.logic.dll!__acrt_stdio_parse_mode<char>(const char * const mode) Line 741
	at minkernel\crts\ucrt\inc\corecrt_internal_stdio.h(741)
sourcemod.logic.dll!common_openfile<char>(const char * const file_name, const char * const mode, const int share_flag, const __crt_stdio_stream stream) Line 33
	at minkernel\crts\ucrt\src\appcrt\stdio\openfile.cpp(33)
sourcemod.logic.dll!_openfile(const char * file_name, const char * mode, int share_flag, _iobuf * public_stream) Line 66
	at minkernel\crts\ucrt\src\appcrt\stdio\openfile.cpp(66)
sourcemod.logic.dll!__crt_char_traits<char>::open_file<char const * const &,char const * const &,int const &,_iobuf *>(const char * const & <args_0>, const char * const & <args_1>, const int & <args_2>, _iobuf * && <args_3>) Line 107
	at minkernel\crts\ucrt\inc\corecrt_internal_traits.h(107)
sourcemod.logic.dll!common_fsopen<char>(const char * const file_name, const char * const mode, const int share_flag) Line 54
	at minkernel\crts\ucrt\src\appcrt\stdio\fopen.cpp(54)
sourcemod.logic.dll!fopen(const char * file, const char * mode) Line 103
	at minkernel\crts\ucrt\src\appcrt\stdio\fopen.cpp(103)
sourcemod.logic.dll!SystemFile::Open(const char * path, const char * mode) Line 176
	at D:\SDK\sourcemod-master\sourcemod\core\logic\smn_filesystem.cpp(176)
sourcemod.logic.dll!sm_OpenFile(SourcePawn::IPluginContext * pContext, const int * params) Line 473
	at D:\SDK\sourcemod-master\sourcemod\core\logic\smn_filesystem.cpp(473)
1f43da5a()
[Frames below may be incorrect and/or missing]
1f4100e7()
sourcepawn.jit.x86.dll!sp::Environment::Invoke(sp::PluginContext * cx, const ke::RefPtr<sp::MethodInfo> & method, int * result) Line 346
	at D:\SDK\sourcemod-master\sourcemod\sourcepawn\vm\environment.cpp(346)
sourcepawn.jit.x86.dll!sp::PluginContext::Invoke(unsigned int fnid, const int * params, unsigned int num_params, int * result) Line 461
	at D:\SDK\sourcemod-master\sourcemod\sourcepawn\vm\plugin-context.cpp(461)
sourcepawn.jit.x86.dll!sp::ScriptedInvoker::Invoke(int * result) Line 290
	at D:\SDK\sourcemod-master\sourcemod\sourcepawn\vm\scripted-invoker.cpp(290)
sourcepawn.jit.x86.dll!sp::ScriptedInvoker::Execute(int * result) Line 190
	at D:\SDK\sourcemod-master\sourcemod\sourcepawn\vm\scripted-invoker.cpp(190)
sourcemod.logic.dll!CPlugin::OnPluginStart() Line 360
	at D:\SDK\sourcemod-master\sourcemod\core\logic\PluginSys.cpp(360)
sourcemod.logic.dll!CPluginManager::RunSecondPass(CPlugin * pPlugin) Line 1347
	at D:\SDK\sourcemod-master\sourcemod\core\logic\PluginSys.cpp(1347)
sourcemod.logic.dll!CPluginManager::LoadAll_SecondPass() Line 1067
	at D:\SDK\sourcemod-master\sourcemod\core\logic\PluginSys.cpp(1067)
sourcemod.logic.dll!CPluginManager::LoadAll(const char * config_path, const char * plugins_path) Line 857
	at D:\SDK\sourcemod-master\sourcemod\core\logic\PluginSys.cpp(857)
sourcemod.2.l4d2.dll!SourceModBase::DoGlobalPluginLoads() Line 510
	at D:\SDK\sourcemod-master\sourcemod\core\sourcemod.cpp(510)
sourcemod.2.l4d2.dll!SourceModBase::LevelInit(const char * pMapName, const char * pMapEntities, const char * pOldLevel, const char * pLandmarkName, bool loadGame, bool background) Line 399
	at D:\SDK\sourcemod-master\sourcemod\core\sourcemod.cpp(399)
sourcemod.2.l4d2.dll!fastdelegate::FastDelegate<bool,char const *,char const *,char const *,char const *,bool,bool>::operator()(const char * <params_0>, const char * <params_1>, const char * <params_2>, const char * <params_3>, bool <params_4>, bool <params_5>) Line 927
	at D:\SDK\metamod-source\core\sourcehook\FastDelegate.h(927)
sourcemod.2.l4d2.dll!__SourceHook_FHCls_IServerGameDLLLevelInitfalse::CMyDelegateImpl::Call(const char * p1, const char * p2, const char * p3, const char * p4, bool p5, bool p6) Line 52
	at D:\SDK\sourcemod-master\sourcemod\core\sourcemod.cpp(52)
metamod.2.l4d2.dll!64766c4c()
engine.dll!65ad7c20()
engine.dll!65b3ed17()
engine.dll!65b5030f()
engine.dll!65b5095b()
engine.dll!65b50a84()
engine.dll!65bb10c4()
engine.dll!65bae6e1()
dedicated.dll!66aa355b()
dedicated.dll!66aa31ce()
dedicated.dll!66aa3906()
dedicated.dll!66ac723e()
dedicated.dll!66ac723e()
dedicated.dll!66aa4361()
ntdll.dll!77b740ec()
ntdll.dll!77b3003d()
KernelBase.dll!75fecafd()
KernelBase.dll!75fecb28()
KernelBase.dll!75feca33()
srcds.exe!001711fd()
ntdll.dll!77b72d6c()
KernelBase.dll!75fde731()
ntdll.dll!77b72c7c()
KernelBase.dll!75fde60b()
kernel32.dll!77930347()
user32.dll!767ef3a8()
ntdll.dll!77b78415()
ntdll.dll!77b78415()
ntdll.dll!77b4a73e()
ntdll.dll!77b78415()
ntdll.dll!77b4a73e()
ntdll.dll!77b72cfc()
kernel32.dll!7792bfd8()
kernel32.dll!7792bb23()
user32.dll!767ed3fd()
KernelBase.dll!75fe06a1()
srcds.exe!00177e7f()
ntdll.dll!77b72cfc()
ntdll.dll!77b72c7c()
ntdll.dll!77b72ddc()
ntdll.dll!77b72ddc()
kernel32.dll!7792fcc9()
ntdll.dll!77b67c6e()
ntdll.dll!77b67c3e()

Message Box

Alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant