sqshq / sampler

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
https://sampler.dev
GNU General Public License v3.0
12.88k stars 573 forks source link

Segfault when asciibox contains a newline #54

Closed vipau closed 5 years ago

vipau commented 5 years ago

If you try this config, it works:

asciiboxes:
  - title: ""
    sample: date +%r%D

Now try adding a newline in the date format (%n):

asciiboxes:
  - title: ""
    sample: date +%r%n%D

And I get:

panic: runtime error: index out of range

goroutine 36 [running]:
github.com/mbndr/figlet4go.(*font).getCharSlice(0xc00018e420, 0xc00000000a, 0xc0002ce4e0, 0x6, 0x6)
    /home/sqshq/go/src/github.com/mbndr/figlet4go/font.go:46 +0x1b9
github.com/mbndr/figlet4go.newAsciiChar(0xc00018e420, 0xc00000000a, 0xc0000122a0, 0x0, 0x0)
    /home/sqshq/go/src/github.com/mbndr/figlet4go/char.go:24 +0xa3
github.com/mbndr/figlet4go.(*AsciiRender).RenderOpts(0xc0001c8010, 0xc0000d2000, 0x14, 0xc0001ce070, 0x14, 0x0, 0x0, 0x0)
    /home/sqshq/go/src/github.com/mbndr/figlet4go/render.go:72 +0x108
github.com/sqshq/sampler/component/asciibox.NewAsciiBox.func1(0xc000252000)
    /home/sqshq/go/src/github.com/sqshq/sampler/component/asciibox/asciibox.go:62 +0x18a
created by github.com/sqshq/sampler/component/asciibox.NewAsciiBox
    /home/sqshq/go/src/github.com/sqshq/sampler/component/asciibox/asciibox.go:57 +0x5ff
sqshq commented 5 years ago

Hi @paualberto, It is fixed and will be released with 1.0.4 Thank you for reporting the issue