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

Warning offline user crashes RAS #38

Closed
jgknight opened this issue Jun 1, 2024 · 0 comments · Fixed by #39
Closed

Warning offline user crashes RAS #38

jgknight opened this issue Jun 1, 2024 · 0 comments · Fixed by #39

Comments

@jgknight
Copy link
Contributor

jgknight commented Jun 1, 2024

Subject of the issue

When a client sends a warning for an offline user, retro-aim-server crashes with a segmentation fault.

Deployment environment

  • retro-aim-server version: Multiple versions, as of 643b26e

  • Install method: source, reproduced on Linux and MacOS

  • Clients used: AIM 5.1.3036, AIM 5.9.6089

  • Other relevant details:

Steps to reproduce

  1. Sign on two users, Alice and Bob
  2. Start a conversation between Alice and Bob
  3. Sign off Alice
  4. Have Bob attempt to warn Alice
  5. Observe that when the warning is sent, RAS crashes with a segmentation fault

Expected behaviour

Expect an error back that the user is offline or otherwise indicate the warning was not successful

Actual behaviour

ras crashes with segmentation fault

Troubleshooting data

icbm.go EvilRequest() attempts to check if the user is online before performing the warning, but it is sending an empty snac which causes a crash when marshalling/encoding the empty snac.

[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x54cffc]

goroutine 24 gp=0x40000e6fc0 m=5 mp=0x40000b4808 [running]:
panic({0x7b97a0?, 0xab22d0?})
        /usr/local/go/src/runtime/panic.go:779 +0x140 fp=0x40001154f0 sp=0x4000115440 pc=0x43f270
runtime.panicmem(...)
        /usr/local/go/src/runtime/panic.go:261
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:881 +0x308 fp=0x4000115550 sp=0x40001154f0 pc=0x459288
github.com/mk6i/retro-aim-server/wire.marshal({0x0, 0x0}, {0x0?, 0x0?, 0x4000173140?}, {0x0, 0x0}, {0x8ab120, 0x4000171500})
        /home/ubuntu/retro-aim-server/wire/encode.go:19 +0x4c fp=0x40001157f0 sp=0x4000115560 pc=0x54cffc
github.com/mk6i/retro-aim-server/wire.Marshal({0x0?, 0x0?}, {0x8ab120?, 0x4000171500?})
        /home/ubuntu/retro-aim-server/wire/encode.go:15 +0xc0 fp=0x4000115870 sp=0x40001157f0 pc=0x54cf70
github.com/mk6i/retro-aim-server/wire.(*FlapClient).SendSNAC(0x4000158870, {0x0, 0x0, 0x0, 0x0}, {0x0, 0x0})
        /home/ubuntu/retro-aim-server/wire/frames.go:189 +0x8c fp=0x40001158c0 sp=0x4000115870 pc=0x54e16c
github.com/mk6i/retro-aim-server/server/oscar/handler.ICBMHandler.EvilRequest({{0x8ad988?, 0x4000075680?}, {0x4000012760?}}, {0x8adb10, 0x4000158960}, 0x40000f89a0, {0x8?, 0x0?, 0x0?, 0x1730
c0?}, ...)
        /home/ubuntu/retro-aim-server/server/oscar/handler/icbm.go:74 +0x17c fp=0x4000115960 sp=0x40001158c0 pc=0x6a3a6c
github.com/mk6i/retro-aim-server/server/oscar/handler.ICBMHandler.EvilRequest-fm({0x8adb10?, 0x4000158960?}, 0x4000115a28?, {0x8d4?, 0x6a?, 0x0?, 0x0?}, {0x8ab220?, 0x4000171380?}, {0x8ab280
?, ...})
        <autogenerated>:1 +0x80 fp=0x40001159d0 sp=0x4000115960 pc=0x6ad5e0
github.com/mk6i/retro-aim-server/server/oscar.HandlerFunc.Handle(0x7b6ac0?, {0x8adb10?, 0x4000158960?}, 0x4000173060?, {0x10?, 0x0?, 0x0?, 0x0?}, {0x8ab220?, 0x4000171380?}, ...)
        /home/ubuntu/retro-aim-server/server/oscar/router.go:50 +0x68 fp=0x4000115a30 sp=0x40001159d0 pc=0x6a07e8
github.com/mk6i/retro-aim-server/server/oscar.Router.Handle({0x79aaa0?}, {0x8adb10, 0x4000158960}, 0x40000f89a0, {0x4, 0x8, 0x0, 0x516c0008}, {0x8ab220, 0x4000171380}, ...)
        /home/ubuntu/retro-aim-server/server/oscar/router.go:72 +0x138 fp=0x4000115ac0 sp=0x4000115a30 pc=0x6a0998
github.com/mk6i/retro-aim-server/server/oscar.dispatchIncomingMessages({0x8adb10, 0x4000158960}, 0x40000f89a0, 0x4000158870, {0x8ab640, 0x4000026268}, 0x4000012760, {0x8aaf60, 0x40000756b0},
 {{0x40000100b9, ...}, ...})
        /home/ubuntu/retro-aim-server/server/oscar/connection.go:90 +0x2b8 fp=0x4000115d00 sp=0x4000115ac0 pc=0x69fe78
jgknight added a commit to jgknight/retro-aim-server that referenced this issue Jun 1, 2024
When a warned screenname is offline ras would attempt to send an empty SNAC,
which caused a crash when marshalling the nil value. Fix by sending a proper
error message, and also detect the nil value when marshalling so we don't crash
on future empty snacs.

Closes mk6i#38
@mk6i mk6i closed this as completed in #39 Jun 1, 2024
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

Successfully merging a pull request may close this issue.

1 participant