找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 85|回复: 1

[开发日志]游戏BUG—base64编码错误

[复制链接]

20

主题

10

回帖

126

积分

管理员

积分
126
发表于 2025-7-6 12:36:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
错误日志信息:
  1. <p>Failed calling InternetOpenUrl, GLE=12029

  2. FAULTING_IP:
  3. cshell!CGameClientShell::base64_encode+1e1 [f:\gamecode\suddensiege\clientshelldll\clientshellshared\gameclientshell.h @ 131]
  4. 058cb341 8808            mov     byte ptr [eax],cl

  5. EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
  6. ExceptionAddress: 058cb341 (cshell!CGameClientShell::base64_encode+0x000001e1)
  7.    ExceptionCode: c0000005 (Access violation)
  8.   ExceptionFlags: 00000000
  9. NumberParameters: 2
  10.    Parameter[0]: 00000001
  11.    Parameter[1]: 0500d000
  12. Attempt to write to address 0500d000

  13. PROCESS_NAME:  engine1.exe

  14. ADDITIONAL_DEBUG_TEXT:  
  15. Use '!findthebuild' command to search for the target build information.
  16. If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols.

  17. MODULE_NAME: cshell

  18. FAULTING_MODULE: 76f50000 ntdll

  19. DEBUG_FLR_IMAGE_TIMESTAMP:  6865e0f1

  20. ERROR_CODE: (NTSTATUS) 0xc0000005 - 0x%p

  21. EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - 0x%p

  22. EXCEPTION_PARAMETER1:  00000001

  23. EXCEPTION_PARAMETER2:  0500d000

  24. WRITE_ADDRESS:  0500d000

  25. FOLLOWUP_IP:
  26. cshell!CGameClientShell::base64_encode+1e1 [f:\gamecode\suddensiege\clientshelldll\clientshellshared\gameclientshell.h @ 131]
  27. 058cb341 8808            mov     byte ptr [eax],cl

  28. MOD_LIST: <ANALYSIS/>

  29. FAULTING_THREAD:  000010a8

  30. BUGCHECK_STR:  APPLICATION_FAULT_INVALID_POINTER_WRITE_WRONG_SYMBOLS

  31. PRIMARY_PROBLEM_CLASS:  INVALID_POINTER_WRITE

  32. DEFAULT_BUCKET_ID:  INVALID_POINTER_WRITE

  33. LAST_CONTROL_TRANSFER:  from 058bcbe9 to 058cb341

  34. STACK_TEXT:  
  35. 0019e058 058bcbe9 0019e0fc 04f20830 04f20831 cshell!CGameClientShell::base64_encode+0x1e1 [f:\gamecode\suddensiege\clientshelldll\clientshellshared\gameclientshell.h @ 131]
  36. 0019f138 05809b41 24ca350c 0019fa4c 003d156e cshell!CNetwork::CS_Chat+0xb9 [F:\gamecode\suddensiege\CLIENTSHELLDLL\ClientShellShared\Network.cpp @ 1932]
  37. 0019f858 057ac6c3 00000044 00000001 00000000 cshell!CScreenRoom::OnCommand+0x1651 [F:\gamecode\suddensiege\ClientShellDLL\SA\ScreenRoom.cpp @ 2056]
  38. 0019f8bc 05a4c951 00000044 00000001 00000000 cshell!CLTGUICommandHandler::SendCommand+0x23 [f:\gamecode\suddensiege\libs\ltguimgr\ltguicommandhandler.h @ 23]
  39. 0019f920 05a4c5cf 0019fa4c 003d156e 0586f7a0 cshell!CLTGUIEditBox::OnEnter+0x31 [f:\gamecode\suddensiege\libs\ltguimgr\ltguieditbox.cpp @ 551]
  40. 0019f97c 05a4b711 0000010d 0019fa4c 003d156e cshell!CLTGUIEditBox::OnChar+0x5f [f:\gamecode\suddensiege\libs\ltguimgr\ltguieditbox.cpp @ 450]
  41. 0019f9e4 0586f7dc 003d156e 00000102 0000000d cshell!CImeCtrl::WndProc+0x1d1 [f:\gamecode\suddensiege\libs\ltguimgr\ltguieditbox.cpp @ 95]
  42. 0019fa4c 74e0145b 003d156e 00000102 0000000d cshell!HookedWindowProc+0x3c [F:\gamecode\suddensiege\CLIENTSHELLDLL\ClientShellShared\GameClientShell.cpp @ 5008]
  43. WARNING: Stack unwind information not available. Following frames may be wrong.
  44. 0019fa78 74df7b4a 0586f7a0 003d156e 00000102 user32+0x4145b
  45. 0019fb60 74df63f0 0586f7a0 00000000 00000102 user32+0x37b4a
  46. 0019fbdc 74de81a0 0019fc8c 004098b8 0019fc08 user32+0x363f0
  47. 0019fbe4 004098b8 0019fc08 00000064 00000000 user32+0x281a0
  48. 0019fc8c 0040af97 00400000 39353336 6475535f engine1+0x98b8
  49. 0019fed0 00630b93 00400000 00000000 00a15b65 engine1+0xaf97
  50. 0019ff70 758cfcc9 0031e000 758cfcb0 0019ffdc engine1!SetMasterDatabase+0x1c4be6
  51. 0019ff80 76fb82ae 0031e000 b759722e 00000000 kernel32+0x1fcc9
  52. 0019ffdc 76fb827e ffffffff 76fd9343 00000000 ntdll+0x682ae
  53. 0019ffec 00000000 006309e0 0031e000 00000000 ntdll+0x6827e


  54. STACK_COMMAND:  ~0s; .ecxr ; kb

  55. FAULTING_SOURCE_CODE:  
  56.    127:                 size_t i;
  57.    128:                 char *p = const_cast<char*>(ret.c_str());
  58.    129:                 
  59.    130:                 for (i = 0; i < in_len - 2; i += 3) {
  60. >  131:                         *p++ = sEncodingTable[(data[i] >> 2) & 0x3F];
  61.    132:                         *p++ = sEncodingTable[((data[i] & 0x3) << 4) | ((int) (data[i + 1] & 0xF0) >> 4)];
  62.    133:                         *p++ = sEncodingTable[((data[i + 1] & 0xF) << 2) | ((int) (data[i + 2] & 0xC0) >> 6)];
  63.    134:                         *p++ = sEncodingTable[data[i + 2] & 0x3F];
  64.    135:                 }
  65.    136:                 if (i < in_len) {


  66. SYMBOL_STACK_INDEX:  0

  67. SYMBOL_NAME:  cshell!CGameClientShell::base64_encode+1e1

  68. FOLLOWUP_NAME:  MachineOwner

  69. IMAGE_NAME:  cshell.dll

  70. BUCKET_ID:  WRONG_SYMBOLS

  71. FAILURE_BUCKET_ID:  INVALID_POINTER_WRITE_c0000005_cshell.dll!CGameClientShell::base64_encode

复制代码


错误原因分析:

  1. CGameClientShell::base64_encode中char *p = const_cast<char*>(ret.c_str());
  2. std::string::c_str() 返回的是一个指向以空字符结尾的常量字符数组的指针但是我去掉了const限制后强制访问导致越界。
复制代码

修复内容:
  1. 不使用 const_cast 去修改 c_str() 返回的指针,使用 std::string 的 operator[] 来访问和修改字符串内容。
复制代码




1

主题

42

回帖

97

积分

注册会员

积分
97
发表于 2025-9-1 02:07:53 | 显示全部楼层

Best Sites

skaskanew click here gratiavitae more info on this page slame-rp link agrorubo.ru visit the site for details flamandrose.ru the article fantastikmir.ru visit the site for details pavel3333 pavel3333.ru vladgate.ru example vr-point.ru site homeimprovementstore online craftingmaterials link modernlighting.ru this website digitalartprints.ru here beautyandwellness.ru example
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|突击重围

GMT+8, 2025-9-9 02:03 , Processed in 1.932818 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表