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

Crash caught when formting markdown link #159

Open
Arkaeriit opened this issue May 4, 2023 · 6 comments
Open

Crash caught when formting markdown link #159

Arkaeriit opened this issue May 4, 2023 · 6 comments

Comments

@Arkaeriit
Copy link
Contributor

I tried to send [](https://xkcd.com/949/) and I got:

        [running]: runtime/debug.Stack()

        ┃ /snap/go/current/src/runtime/debug/stack.go:24 +0x65
        ┃ 

        main.protectFromPanic()

        ┃ /home/ubuntu/devzat/util.go:109 +0x5f
        ┃ 

        panic({0xe50200, 0x17a61a0})

        ┃ /snap/go/current/src/runtime/panic.go:884 +0x213
        ┃ 

        github.com/quackduck/go-term-markdown.(*renderer).RenderNode(0xc0000f0420, {0x1180fe0, 0xc000090000}, {0x118a660?, 0xc000538b60?}, 0x1)

        ┃ /home/ubuntu/go/pkg/mod/github.com/quackduck/go-term-markdown@v0.14.2/renderer.go:310 +0x1381
        ┃ 

        github.com/gomarkdown/markdown.Render.func1({0x118a660?, 0xc000538b60?}, 0x20?)

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/markdown.go:63 +0x47
        ┃ 

        github.com/gomarkdown/markdown/ast.NodeVisitorFunc.Visit(0x118a810?, {0x118a660?, 0xc000538b60?}, 0xe0?)

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/ast/node.go:574 +0x2e
        ┃ 

        github.com/gomarkdown/markdown/ast.Walk({0x118a660, 0xc000538b60}, {0x1183760, 0xc000078d60})

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/ast/node.go:546 +0x59
        ┃ 

        github.com/gomarkdown/markdown/ast.Walk({0x118a810, 0xc000131380}, {0x1183760, 0xc000078d60})

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/ast/node.go:557 +0x145
        ┃ 

        github.com/gomarkdown/markdown/ast.Walk({0x118a348, 0xc000131320}, {0x1183760, 0xc000078d60})

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/ast/node.go:557 +0x145
        ┃ 

        github.com/gomarkdown/markdown/ast.WalkFunc(...)

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/ast/node.go:580
        ┃ 

        github.com/gomarkdown/markdown.Render({0x118a348, 0xc000131320}, {0x1187d10, 0xc0000f0420})

        ┃ /home/ubuntu/go/pkg/mod/github.com/gomarkdown/markdown@v0.0.0-20230322041520-c84983bdbf2a/markdown.go:62 +0xd7
        ┃ 

        github.com/quackduck/go-term-markdown.Render({0xc000820ac0, 0x1a}, 0xf4e1c3?, 0x2?, {0x0, 0x0, 0x0})

        ┃ /home/ubuntu/go/pkg/mod/github.com/quackduck/go-term-markdown@v0.14.2/markdown.go:32 +0xbe
        ┃ 

        main.mdRender({0xc000820aa0?, 0x4?}, 0x6, 0xbf)

        ┃ /home/ubuntu/devzat/util.go:134 +0x10f
        ┃

        main.(*User).writeln(0xc00057a900, {0xc00077ee28, 0x13}, {0xc000820aa0, 0x19})

        ┃ /home/ubuntu/devzat/main.go:583 +0x291
        ┃

        main.(*Room).broadcastNoBridges(0x17b05e0, {0xc00077ee28, 0x13}, {0xc000820aa0, 0x19})

        ┃ /home/ubuntu/devzat/main.go:266 +0x125
        ┃

        main.(*Room).broadcast(0x17b05e0?, {0xc00077ee28?, 0x13?}, {0xc000820aa0?, 0x19?})

        ┃ /home/ubuntu/devzat/main.go:217 +0x348
        ┃

        main.runCommands({0xc000820a00?, 0xc000346330?}, 0xc00020e400)

        ┃ /home/ubuntu/devzat/commands.go:121 +0x432
        ┃

        main.(*User).repl(0xc00020e400)

        ┃ /home/ubuntu/devzat/main.go:804 +0x445
        ┃

        main.main.func3({0x1190bd8?, 0xc00029a340})

        ┃ /home/ubuntu/devzat/main.go:152 +0xaf
        ┃

        github.com/gliderlabs/ssh.(*session).handleRequests.func1()

        ┃ /home/ubuntu/go/pkg/mod/github.com/gliderlabs/ssh@v0.3.5/session.go:261 +0x2d
        ┃

        created by github.com/gliderlabs/ssh.(*session).handleRequests

        ┃ /home/ubuntu/go/pkg/mod/github.com/gliderlabs/ssh@v0.3.5/session.go:260 +0x51c
        ┃
@quackduck
Copy link
Owner

Looks like the error happens on this line in the renderer:

https://github.com/quackduck/go-term-markdown/blob/v0.14.2/renderer.go#LL310C3-L310C3

Very strange

@quackduck
Copy link
Owner

quackduck commented May 4, 2023

Well actually it makes sense right? If you're trying to link something you need to give the link some display text, right?

Of course, a panic is the wrong way to respond to this, but also it doesn't crash the server lol. So we have two options, make the renderer return an error or just don't do anything.

@Arkaeriit
Copy link
Contributor Author

Even with a text, the renderer does not changes the output much. I think the render should just display input text in this case.

@quackduck
Copy link
Owner

do you mean just the link text?

@Arkaeriit
Copy link
Contributor Author

I mean if I type [](http://exmaple.com), the markdown renderer outputs [](http://exmaple.com).

@quackduck
Copy link
Owner

What should it output?

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

2 participants