walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
600 stars 17 forks source link

Crash on 'moar /var/log/syslog' #18

Closed demoulin closed 4 years ago

demoulin commented 4 years ago

How to reproduce:

  1. moar /var/log/syslog
  2. use '>' to go to end of document
Version: 0.9.10
LANG   : en_US.UTF-8
TERM   : xterm-256color

GOOS    : linux
GOARCH  : 386
Compiler: gc
NumCPU  : 8

panic: runtime error: slice bounds out of range [:-2147483591] [recovered]
        panic: runtime error: slice bounds out of range [:-2147483591] [recovered]
        panic: runtime error: slice bounds out of range [:-2147483591]

goroutine 1 [running]:
main.main.func1()
        /Users/johan/src/moar/moar.go:85 +0x51f
panic(0x81c76a0, 0xad9c000)
        /usr/local/Cellar/go/1.13.3/libexec/src/runtime/panic.go:679 +0x16b
main._StartPaging.func1(0x820a300, 0xa40a0f0, 0xa40c400)
        /Users/johan/src/moar/moar.go:160 +0xe4
panic(0x81c76a0, 0xad9c000)
        /usr/local/Cellar/go/1.13.3/libexec/src/runtime/panic.go:679 +0x16b
github.com/walles/moar/m.(*Reader)._GetLinesUnlocked(0xa456120, 0x7fffffff, 0x3b, 0x80af40b)
        /Users/johan/src/moar/m/reader.go:357 +0x1ec
github.com/walles/moar/m.(*Reader).GetLines(0xa456120, 0x7fffffff, 0x3b, 0x0)
        /Users/johan/src/moar/m/reader.go:318 +0x75
github.com/walles/moar/m.(*Pager)._AddLines(0xa456180, 0xa456150, 0x0, 0x0)
        /Users/johan/src/moar/m/pager.go:178 +0x56
github.com/walles/moar/m.(*Pager)._Redraw(0xa456180, 0xa456150, 0x0, 0x0)
        /Users/johan/src/moar/m/pager.go:236 +0x4b
github.com/walles/moar/m.(*Pager).StartPaging(0xa456180, 0xa456150, 0x820a300, 0xa40a0f0)
        /Users/johan/src/moar/m/pager.go:696 +0x1a6
main._StartPaging(0xa456120)
        /Users/johan/src/moar/moar.go:172 +0x12e
main.main()
        /Users/johan/src/moar/moar.go:143 +0x24c
walles commented 4 years ago

Tried this and:

This will have to be fixed.

walles commented 4 years ago

Tried with a 32 bit build on Mac and that fails as well, on a short input file.

walles commented 4 years ago

Just released 0.9.11 which shouldn't crash like this, please verify if it works for you @demoulin!

demoulin commented 4 years ago

Yes, it works now. Thanks!