Skip to content

StandardMessageCodec decoding error with long strings #163

@wud147

Description

@wud147

Flutter Version

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale en-CN)

Golang Version

go version go1.12.5 darwin/amd64

Steps to Reproduce

1、 Add plugin shared_preferences from https://github.com/go-flutter-desktop/plugins

2、 Call function "setString" with a very long string such as 60000 characters

panic: runtime error: slice bounds out of range

goroutine 1 [running, locked to thread]:
bytes.(*Buffer).Next(...)
	/usr/local/Cellar/go/1.12.5/libexec/src/bytes/buffer.go:327
github.com/go-flutter-desktop/go-flutter/plugin.StandardMessageCodec.readByteSlice(0xc00014b5c0, 0x400b6eb, 0x10, 0x41ace80, 0xc0000d8701, 0xc000012d90)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-message-codec.go:452 +0x2ab
github.com/go-flutter-desktop/go-flutter/plugin.StandardMessageCodec.readString(0xc00014b5c0, 0x5, 0xc000012d90, 0x0, 0x0)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-message-codec.go:438 +0x2f
github.com/go-flutter-desktop/go-flutter/plugin.StandardMessageCodec.readValueAligned(0xc00014b5c0, 0xc387, 0x41ad080, 0xc000012d90, 0x0, 0x0)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-message-codec.go:571 +0x500
github.com/go-flutter-desktop/go-flutter/plugin.StandardMessageCodec.readMap(0xc00014b5c0, 0xc387, 0xc0005de250, 0x0, 0x0)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-message-codec.go:528 +0x102
github.com/go-flutter-desktop/go-flutter/plugin.StandardMessageCodec.readValueAligned(0xc00014b5c0, 0xc387, 0x41ad080, 0xc0005de250, 0x0, 0x0)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-message-codec.go:589 +0x772
github.com/go-flutter-desktop/go-flutter/plugin.StandardMethodCodec.DecodeMethodCall(0xc00060a000, 0xc387, 0xc387, 0x4055f80, 0xc00010d160, 0xc0005b7920, 0x48, 0xc000000180, 0x411fd21)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/standard-method-codec.go:58 +0xe2
github.com/go-flutter-desktop/go-flutter/plugin.(*MethodChannel).handleChannelMessage(0xc000150140, 0xc00060a000, 0xc387, 0xc387, 0x4231860, 0xc00010d160, 0xc00010d160, 0x41d5f80)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/plugin/method-channel.go:129 +0x70
github.com/go-flutter-desktop/go-flutter.(*messenger).handlePlatformMessage(0xc0000be150, 0xc00014b590)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/messenger.go:79 +0x167
github.com/go-flutter-desktop/go-flutter/embedder.proxy_platform_message_callback(0x7ffeefbfd1f0, 0xc0000d8018)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/embedder/embedder_proxy.go:18 +0xe9
github.com/go-flutter-desktop/go-flutter/embedder._cgoexpwrap_30b92b790699_proxy_platform_message_callback(0x7ffeefbfd1f0, 0xc0000d8018)
	_cgo_gotypes.go:448 +0x35
github.com/go-gl/glfw/v3.2/glfw._Cfunc_glfwWaitEventsTimeout(0x3f90624dd2f1a9fc)
	_cgo_gotypes.go:1946 +0x41
github.com/go-gl/glfw/v3.2/glfw.WaitEventsTimeout(0x3f90624dd2f1a9fc)
	/Users/*****/go/pkg/mod/github.com/go-gl/glfw@v0.0.0-20190519095719-e6da0acd62b1/v3.2/glfw/window.go:823 +0x2d
github.com/go-flutter-desktop/go-flutter.(*Application).Run(0xc0000d2000, 0x0, 0x0)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/application.go:229 +0xa0d
github.com/go-flutter-desktop/go-flutter.Run(0xc0000c0080, 0x4, 0x4, 0x2, 0xc0000b3f78)
	/Users/*****/go/pkg/mod/github.com/go-flutter-desktop/go-flutter@v0.19.1-0.20190609200834-a6ff8ec870f4/application.go:23 +0x4d
main.main()
	/Users/*****/desktop/cmd/main.go:24 +0x189

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginIssue about an existing or possible plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions