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

openapi change can crash in console rendering #139

Open
LasneF opened this issue May 15, 2024 · 1 comment
Open

openapi change can crash in console rendering #139

LasneF opened this issue May 15, 2024 · 1 comment

Comments

@LasneF
Copy link
Contributor

LasneF commented May 15, 2024

given an API diff change got this errpr

openapi-changes version: 0.0.62 | compiled: Thu, 25 Apr 2024 16:39:09 UTC

DONE starting console...

panic: runtime error: slice bounds out of range [:2122] with capacity 2121 [recovered]
panic: runtime error: slice bounds out of range [:2122] with capacity 2121

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1()
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/application.go:285 +0x45
panic({0x1820c40?, 0xc000c9bdb8?})
/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/panic.go:770 +0x132
github.com/pb33f/openapi-changes/tui.RenderDiff(0xc000dec160?, 0xc000dec2c0, 0xc001806690, 0xc0001263f0)
/home/runner/work/openapi-changes/openapi-changes/tui/diff_view.go:239 +0x4fbd
github.com/pb33f/openapi-changes/tui.BuildApplication.func2(0x0?)
/home/runner/work/openapi-changes/openapi-changes/tui/main_console.go:84 +0x3d
github.com/rivo/tview.(*TreeView).InputHandler.func1.1()
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/treeview.go:769 +0x2f
github.com/rivo/tview.(*TreeView).InputHandler.func1(0xc000dec420?, 0xc00048c000?)
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/treeview.go:822 +0xa2
github.com/rivo/tview.(*TreeView).InputHandler.(*Box).WrapInputHandler.func2(0xc00049d5e0?, 0xc000446008?)
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Grid).InputHandler.func1(0xc001b777c0, 0xc001c7dc80)
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/grid.go:663 +0x1b7
github.com/rivo/tview.(*Grid).InputHandler.(*Box).WrapInputHandler.func2(0xc000a95950?, 0xc000eaf768?)
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/box.go:167 +0x50
github.com/rivo/tview.(*Application).Run(0xc0015208c0)
/home/runner/go/pkg/mod/github.com/rivo/[email protected]/application.go:404 +0x9a2
github.com/pb33f/openapi-changes/cmd.runLeftRightCompare({0xc000022200, 0x3a}, {0xc00001e190, 0x50}, 0xc0000241e0, 0xc000024240, {0x0, 0x0}, 0x1)
/home/runner/work/openapi-changes/openapi-changes/cmd/console.go:383 +0x815
github.com/pb33f/openapi-changes/cmd.init.0.GetConsoleCommand.func1(0xc000158308, {0xc000088f40, 0x2, 0x18c80eb?})
/home/runner/work/openapi-changes/openapi-changes/cmd/console.go:248 +0x9af
github.com/spf13/cobra.(*Command).execute(0xc000158308, {0xc000088ee0, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0x234e3a0)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/pb33f/openapi-changes/cmd.Execute({0x1ccf124?, 0x19?}, {0x1cd9660?, 0x18d87c5?}, {0xc000026be0?, 0xc00007a000?})
/home/runner/work/openapi-changes/openapi-changes/cmd/root.go:51 +0x91
main.main()
/home/runner/work/openapi-changes/openapi-changes/openapi-changes.go:29 +0x158

    Looks on header added
@LasneF
Copy link
Contributor Author

LasneF commented May 15, 2024

got a systematic way to reproduce

it occurs when the issue is like that
image

and in term of report in this case
{
"breaking": true,
"change": 2,
"changeText": "property_added",
"context": {
"newLine": 2012,
"newColumn": 18
},
"new": "bytes=[0-9]+-[0-9]+",
"original": "",
"property": "pattern"
}

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

1 participant