Skip to content

bug: len(byteArray) can be minus without panic #732

Closed
@hajimehoshi

Description

@hajimehoshi
package main

import (
	"fmt"
)

func main() {
	a := make([]byte, 4096)
	b := a[8192:]
	fmt.Println(len(b))
}

https://gopherjs.github.io/playground/#/Sxg5Yfe4Y0

Actual result:
-4096

Expected result:
panic: runtime error: slice bounds out of range

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions